diff options
author | Giuseppe D'Angelo <[email protected]> | 2021-09-30 01:07:06 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <[email protected]> | 2021-10-09 15:38:25 +0200 |
commit | fa3b9767c5802805ed73f897e6c3b80f21c699ac (patch) | |
tree | 43c4360b5386602866336ab8d6d25277c7f2c7ec | |
parent | 1243279ddc92bab67bc75e4ecb4ce793715ed11f (diff) |
Fix the implicit capture of `this` in lambdas when capturing [=]
C++20 deprecated the implicit capture of `this` when a lambda just
captures [=], so we must stop relying on that. Adding `this` to such
a capture list works in C++20, but it's illegal in C++17 (d'oh).
Hence, turn these captures into capturing (by value) what they need.
Pick-to: 6.2
Change-Id: I67fc1572b68dec9d3bdb78da3e03471970b9ce12
Reviewed-by: Fabian Kosmale <[email protected]>
4 files changed, 9 insertions, 9 deletions
diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp index 854937f4ae..27c6d5c1c5 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp @@ -437,7 +437,7 @@ QString QQmlDebugTranslationServiceImpl::foundElidedText(QObject *textObject, co if (!d->elideConnections.contains(quickItem)) { // add "refresh" elide state connections which remove themself - auto clearElideInformation = [=]() { + auto clearElideInformation = [this, quickItem]() { //quickItem->setColor(originColor); for (QMetaObject::Connection connection : d->elideConnections.value(quickItem)) quickItem->disconnect(connection); diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 8dfe55fee6..b865270973 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -2567,7 +2567,7 @@ bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e) { Q_D(QQuickFlickable); - auto wantsPointerEvent_helper = [=]() { + auto wantsPointerEvent_helper = [this, d, i, e]() { QPointerEvent *pe = static_cast<QPointerEvent *>(e); QQuickDeliveryAgentPrivate::localizePointerEvent(pe, this); const bool wants = d->wantsPointerEvent(pe); diff --git a/src/quickdialogs2/quickdialogs2quickimpl/qquickfolderbreadcrumbbar.cpp b/src/quickdialogs2/quickdialogs2quickimpl/qquickfolderbreadcrumbbar.cpp index 337d25a6b1..4dcd5e2a5f 100644 --- a/src/quickdialogs2/quickdialogs2quickimpl/qquickfolderbreadcrumbbar.cpp +++ b/src/quickdialogs2/quickdialogs2quickimpl/qquickfolderbreadcrumbbar.cpp @@ -125,7 +125,7 @@ void QQuickFolderBreadcrumbBarPrivate::repopulate() QBoolBlocker repopulateGuard(repopulating); - auto failureCleanup = [=](){ + auto failureCleanup = [this, q](){ folderPaths.clear(); while (q->count() > 0) q->removeItem(q->itemAt(0)); diff --git a/src/quicktemplates2/qquickselectionrectangle.cpp b/src/quicktemplates2/qquickselectionrectangle.cpp index ae583661f2..5f4c37c41e 100644 --- a/src/quicktemplates2/qquickselectionrectangle.cpp +++ b/src/quicktemplates2/qquickselectionrectangle.cpp @@ -177,12 +177,12 @@ QQuickSelectionRectanglePrivate::QQuickSelectionRectanglePrivate() m_scrollSpeed = QSizeF(qAbs(dist.width() * 0.007), qAbs(dist.height() * 0.007)); }); - QObject::connect(m_tapHandler, &QQuickTapHandler::tapped, [=](QEventPoint) { + QObject::connect(m_tapHandler, &QQuickTapHandler::tapped, [this] { m_selectable->clearSelection(); updateActiveState(false); }); - QObject::connect(m_tapHandler, &QQuickTapHandler::longPressed, [=]() { + QObject::connect(m_tapHandler, &QQuickTapHandler::longPressed, [this]() { if (handleUnderPos(m_tapHandler->point().pressPosition()) != nullptr) { // Don't allow press'n'hold to start a new // selection if it started on top of a handle. @@ -206,7 +206,7 @@ QQuickSelectionRectanglePrivate::QQuickSelectionRectanglePrivate() updateActiveState(true); }); - QObject::connect(m_dragHandler, &QQuickDragHandler::activeChanged, [=]() { + QObject::connect(m_dragHandler, &QQuickDragHandler::activeChanged, [this]() { const QPointF pos = m_dragHandler->centroid().position(); if (m_dragHandler->active()) { m_selectable->clearSelection(); @@ -223,7 +223,7 @@ QQuickSelectionRectanglePrivate::QQuickSelectionRectanglePrivate() } }); - QObject::connect(m_dragHandler, &QQuickDragHandler::centroidChanged, [=]() { + QObject::connect(m_dragHandler, &QQuickDragHandler::centroidChanged, [this]() { if (!m_dragging) return; const QPointF pos = m_dragHandler->centroid().position(); @@ -309,7 +309,7 @@ QQuickItem *QQuickSelectionRectanglePrivate::createHandle(QQmlComponent *delegat hoverHandler->setCursorShape(Qt::SizeFDiagCursor); QQuickItemPrivate::get(handleItem)->addPointerHandler(hoverHandler); - QObject::connect(dragHandler, &QQuickDragHandler::activeChanged, [=]() { + QObject::connect(dragHandler, &QQuickDragHandler::activeChanged, [this, corner, handleItem, dragHandler]() { if (dragHandler->active()) { const QPointF localPos = dragHandler->centroid().position(); const QPointF pos = handleItem->mapToItem(handleItem->parentItem(), localPos); @@ -330,7 +330,7 @@ QQuickItem *QQuickSelectionRectanglePrivate::createHandle(QQmlComponent *delegat } }); - QObject::connect(dragHandler, &QQuickDragHandler::centroidChanged, [=]() { + QObject::connect(dragHandler, &QQuickDragHandler::centroidChanged, [this, corner, handleItem, dragHandler]() { if (!m_dragging) return; |