From: Méven Car Date: Sun, 24 Nov 2024 13:40:25 +0000 (+0100) Subject: Switch to C++20 X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/25a5a1df171770ea1f6c9665c4f048807d6fc80d Switch to C++20 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 496004541..bc00ca981 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,11 @@ project(Dolphin VERSION ${RELEASE_SERVICE_VERSION}) set(QT_MIN_VERSION "6.4.0") set(KF6_MIN_VERSION "6.2.0") +# use C++20 like KF6 itself +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) + # ECM setup find_package(ECM ${KF6_MIN_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index c6c56ce24..5494d7c41 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -303,7 +303,7 @@ void DolphinViewContainer::connectUrlNavigator(DolphinUrlNavigator *urlNavigator // Url changes are still done via m_urlNavigator. connect(urlNavigator, &DolphinUrlNavigator::urlChanged, m_urlNavigator.get(), &DolphinUrlNavigator::setLocationUrl); - connect(urlNavigator, &DolphinUrlNavigator::urlsDropped, this, [=](const QUrl &destination, QDropEvent *event) { + connect(urlNavigator, &DolphinUrlNavigator::urlsDropped, this, [=, this](const QUrl &destination, QDropEvent *event) { m_view->dropUrls(destination, event, urlNavigator->dropWidget()); }); // Aside from these, only visual things need to be connected. diff --git a/src/itemactions/movetonewfolderitemaction.cpp b/src/itemactions/movetonewfolderitemaction.cpp index 295900331..cfd6f25ee 100644 --- a/src/itemactions/movetonewfolderitemaction.cpp +++ b/src/itemactions/movetonewfolderitemaction.cpp @@ -30,7 +30,7 @@ QList MoveToNewFolderItemAction::actions(const KFileItemListPropertie QAction *createFolderFromSelected = new QAction(i18nc("@action:inmenu", "Move to New Folder…"), parentWidget); createFolderFromSelected->setIcon(QIcon::fromTheme(QStringLiteral("folder-new"))); - connect(createFolderFromSelected, &QAction::triggered, this, [=]() { + connect(createFolderFromSelected, &QAction::triggered, this, [=, this]() { QString selectedFileDirPath = selectedItems.at(0).url().toString().remove(selectedItems.at(0).name()); if (selectedFileDirPath.endsWith(QStringLiteral("/"))) { selectedFileDirPath.removeLast(); diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index b0ea32940..38ec6841a 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -1608,10 +1608,10 @@ void KItemListView::slotRubberBandActivationChanged(bool active) curve.addCubicBezierSegment(QPointF(0.4, 0.0), QPointF(1.0, 1.0), QPointF(1.0, 1.0)); animation->setEasingCurve(curve); - connect(animation, &QVariantAnimation::valueChanged, this, [=](const QVariant &) { + connect(animation, &QVariantAnimation::valueChanged, this, [=, this](const QVariant &) { update(); }); - connect(animation, &QVariantAnimation::finished, this, [=]() { + connect(animation, &QVariantAnimation::finished, this, [=, this]() { m_rubberBandAnimations.removeAll(animation); delete animation; }); diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index 5b17023a3..92ba18bf5 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -278,7 +278,7 @@ void TerminalPanel::sendCdToTerminalKIOFuse(const QUrl &url) // If we can't do that for any reason, silently fail. auto reply = m_kiofuseInterface.mountUrl(url.toString()); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *watcher) { + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=, this](QDBusPendingCallWatcher *watcher) { watcher->deleteLater(); if (!reply.isError()) { // Successfully mounted, point to the KIOFuse equivalent path. @@ -326,7 +326,7 @@ void TerminalPanel::slotKonsolePartCurrentDirectoryChanged(const QString &dir) auto reply = m_kiofuseInterface.remoteUrl(m_konsolePartCurrentDirectory); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *watcher) { + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=, this](QDBusPendingCallWatcher *watcher) { watcher->deleteLater(); if (reply.isError()) { // KIOFuse errored out... just show the normal URL diff --git a/src/settings/viewmodes/contentdisplaytab.cpp b/src/settings/viewmodes/contentdisplaytab.cpp index 2d817277c..c08c4c191 100644 --- a/src/settings/viewmodes/contentdisplaytab.cpp +++ b/src/settings/viewmodes/contentdisplaytab.cpp @@ -106,7 +106,7 @@ ContentDisplayTab::ContentDisplayTab(QWidget *parent) #ifndef Q_OS_WIN connect(m_recursiveDirectorySizeLimit, &QSpinBox::valueChanged, this, &SettingsPageBase::changed); connect(m_numberOfItems, &QRadioButton::toggled, this, &SettingsPageBase::changed); - connect(m_sizeOfContents, &QRadioButton::toggled, this, [=]() { + connect(m_sizeOfContents, &QRadioButton::toggled, this, [=, this]() { m_recursiveDirectorySizeLimit->setEnabled(m_sizeOfContents->isChecked()); }); connect(m_noDirectorySize, &QRadioButton::toggled, this, &SettingsPageBase::changed); diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index d9d7f2ef3..2f2ff586d 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -137,10 +137,10 @@ DolphinView::DolphinView(const QUrl &url, QWidget *parent) m_view->setAccessibleParentsObject(m_container); #endif setFocusProxy(m_container); - connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, [=] { + connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, [this] { hideToolTip(); }); - connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] { + connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, [this] { hideToolTip(); });