Bug 411197 - Unable to compile, error: ‘const class QString’ has no member named ‘chopped’
Summary: Unable to compile, error: ‘const class QString’ has no member named ‘chopped’
Status: RESOLVED FIXED
Alias: None
Product: Falkon
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: David Rosca
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-23 07:00 UTC by Raphael Rosch
Modified: 2020-02-02 17:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
patch to allow compilation for qt<5.10 (6.93 KB, patch)
2019-09-23 02:20 UTC, Raphael Rosch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Raphael Rosch 2019-08-23 07:00:41 UTC
When trying to compile from git source, I get an error at


[ 16%] Building CXX object src/lib/CMakeFiles/FalkonPrivate.dir/session/sessionmanagerdialog.cpp.o
/fittybones/tmp/github/falkon/src/lib/preferences/thememanager.cpp: In member function ‘ThemeManager::Theme ThemeManager::parseTheme(const QString&, const QString&)’:
/fittybones/tmp/github/falkon/src/lib/preferences/thememanager.cpp:140:27: error: ‘const class QString’ has no member named ‘chopped’; did you mean ‘chop’?
     info.themePath = path.chopped(1);
                           ^~~~~~~
                           chop
make[2]: *** [src/lib/CMakeFiles/FalkonPrivate.dir/build.make:2527: src/lib/CMakeFiles/FalkonPrivate.dir/preferences/thememanager.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:178: src/lib/CMakeFiles/FalkonPrivate.dir/all] Error 2
make: *** [Makefile:141: all] Error 2




I'm running FC27 32bit, so latest qt5 available is 5.9.6, but "chopped()" was only introduced in qt 5.10.

The fix would be either to add a check requiring version 5.10 of qt (my 5.9.6 passed all pre-compile checks), or to use a different function than "chopped()".


(My obvious preference would be to make it compileable with 5.9.6, so I am not forced to upgrade just to compile falkon --which I know I will have to do soon anyways, given the fix to 5.13 for the "close views" crash in konqueror-- if this is the only 5.10 func used, I hope this is acceptable. I want to start trying out falkon as a replacement for all the broken browsers on my system now, but I want to compile in h264, as well as test to see if another bug I ran into while creating a simple theme for falkon has already been fixed). Thanks in advance. I'm excited to start using falkon!
Comment 1 vialav 2019-09-07 18:38:23 UTC
Hi, Raphael,

I've stumbled upon the same issue, and solved it this way: 

- clone the falkon repo, and,
- revert commit f792104be55fca03ad17cdc4244aafce47d0914e (or apply the patch below), which is essentially what you've asked for (the only lost is the ability to remove locally installed themes, which I'm sure you could live without),
- compile it without Python plugins support (see below);

There is a caveat, however, that you most likely would need to revert commit 479933e095168d07a54913f88642cfed4828c167 to compile it with PySide2 << 5.12, if you want Python plugins support under Qt 5.9.6. Be aware that last revert needs some extra "polishing" plus back-porting of the two special commits-fixes "from a future version" to alleviate a bug in PySide2

I'm myself a happy user of the latest Falkon and nearly latest the KDE Plasma, all are the manually compiled Ubuntu system packages under Qt 5.9.5 LTS ;-)

--- src/lib/preferences/thememanager.cpp
+++ src/lib/preferences/thememanager.cpp
@@ -26,17 +26,15 @@
 #include "mainapplication.h"

 #include <QDir>
-#include <QMessageBox>

 ThemeManager::ThemeManager(QWidget* parent, Preferences* preferences)
-    : QWidget(parent)
+    : QWidget()
     , ui(new Ui::ThemeManager)
     , m_preferences(preferences)
 {
     ui->setupUi(parent);
     ui->listWidget->setLayoutDirection(Qt::LeftToRight);
     ui->license->hide();
-    ui->remove->setIcon(QIcon::fromTheme(QSL("edit-delete")));

     Settings settings;
     settings.beginGroup("Themes");
@@ -69,7 +67,6 @@ ThemeManager::ThemeManager(QWidget* pare

     connect(ui->listWidget, &QListWidget::currentItemChanged, this, &ThemeManager::currentChanged);
     connect(ui->license, &ClickableLabel::clicked, this, &ThemeManager::showLicense);
-    connect(ui->remove, &QPushButton::clicked, this, &ThemeManager::removeTheme);

     currentChanged();
 }
@@ -88,25 +85,6 @@ void ThemeManager::showLicense()
     v->show();
 }

-void ThemeManager::removeTheme()
-{
-    QListWidgetItem* currentItem = ui->listWidget->currentItem();
-    if (!currentItem) {
-        return;
-    }
-    Theme currentTheme = m_themeHash[currentItem->data(Qt::UserRole).toString()];
-
-    const auto button = QMessageBox::warning(this, tr("Confirmation"),
-                                             tr("Are you sure you want to remove '%1'?").arg(currentTheme.name),
-                                             QMessageBox::Yes | QMessageBox::No);
-    if (button != QMessageBox::Yes) {
-        return;
-    }
-
-    QDir(currentTheme.themePath).removeRecursively();
-    delete currentItem;
-}
-
 void ThemeManager::currentChanged()
 {
     QListWidgetItem* currentItem = ui->listWidget->currentItem();
@@ -120,7 +98,6 @@ void ThemeManager::currentChanged()
     ui->author->setText(currentTheme.author);
     ui->description->setText(currentTheme.description);
     ui->license->setHidden(currentTheme.license.isEmpty());
-    ui->remove->setEnabled(QFileInfo(currentTheme.themePath).isWritable());
 }

 ThemeManager::Theme ThemeManager::parseTheme(const QString &path, const QString &name)
@@ -137,7 +114,6 @@ ThemeManager::Theme ThemeManager::parseT
     info.name = metadata.name();
     info.description = metadata.comment();
     info.author = metadata.value(QSL("X-Falkon-Author")).toString();
-    info.themePath = path.chopped(1);

     const QString iconName = metadata.icon();
     if (!iconName.isEmpty()) {
--- src/lib/preferences/thememanager.h
+++ src/lib/preferences/thememanager.h
@@ -45,7 +45,6 @@ public:
 private Q_SLOTS:
     void currentChanged();
     void showLicense();
-    void removeTheme();

 private:
     struct Theme {
@@ -55,7 +54,6 @@ private:
         QString author;
         QString description;
         QString license;
-        QString themePath;
     };

     Theme parseTheme(const QString &path, const QString &name);
Comment 2 Raphael Rosch 2019-09-23 02:20:24 UTC
Created attachment 122814 [details]
patch to allow compilation for qt<5.10
Comment 3 Raphael Rosch 2019-09-23 02:22:09 UTC
Hi Vialav,

thank you for your reply (sorry for the delay, I somehow missed it in my inbox). I went about it another way, and just changed the

     info.themePath = path.chopped(1);

to two lines:

    info.themePath = path;
    info.themePath.chop(1);

Which allowed me compile that part, but then I ran into another problem:

 undefined reference to `bool QTest::qCompare [...]

which took a few fixes (this happened in multiple locations and files). Not sure why I couldn't compile, did you have problems there too? In any case, I have attached the patch necessary to get it to compile for me.
Comment 4 Juraj 2020-02-02 17:18:08 UTC
Git commit 9eaffd1208f715785eac5b6d58e1bdb384629dbe by Juraj Oravec.
Committed on 02/02/2020 at 17:17.
Pushed by jurajo into branch 'master'.

Autotests Qml - fix compilation with Qt 5.9

Summary: BUG: 411197

Test Plan: Compile with Qt 5.9, e.g. on Ubuntu 18.04

Reviewers: #falkon, drosca

Reviewed By: #falkon, drosca

Subscribers: drosca, falkon

Tags: #falkon

Differential Revision: https://phabricator.kde.org/D27102

M  +1    -1    autotests/qml/qmlclipboardapitest.cpp
M  +5    -5    autotests/qml/qmlcookiesapitest.cpp
M  +1    -1    autotests/qml/qmlhistoryapitest.cpp
M  +3    -3    autotests/qml/qmltabsapitest.cpp
M  +2    -2    autotests/qml/qmltopsitesapitest.cpp

https://commits.kde.org/falkon/9eaffd1208f715785eac5b6d58e1bdb384629dbe