From 339323b999feed077adecc0afaa215f8caffc043 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Fri, 21 Jul 2023 20:06:28 +0300 Subject: [PATCH] examples/: implicit capture of `this` via [=] is deprecated in C++20 Change-Id: I43b04517e9e3a30468c8ce702c9a49968c0ddc4d Reviewed-by: Thiago Macieira --- examples/corelib/serialization/cbordump/main.cpp | 4 ++-- examples/vulkan/hellovulkancubes/mainwindow.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/corelib/serialization/cbordump/main.cpp b/examples/corelib/serialization/cbordump/main.cpp index 4c02abd304..de31a588bd 100644 --- a/examples/corelib/serialization/cbordump/main.cpp +++ b/examples/corelib/serialization/cbordump/main.cpp @@ -446,7 +446,7 @@ void CborDumper::dumpOneDetailed(int nestingLevel) if (cborNumberSize(value) != actualSize) printf(" (overlong)"); }; - auto print = [=](const char *descr, const char *fmt, ...) { + auto print = [&](const char *descr, const char *fmt, ...) { qint64 prevOffset = offset; offset = reader.currentOffset(); if (prevOffset == offset) @@ -480,7 +480,7 @@ void CborDumper::dumpOneDetailed(int nestingLevel) return print(descr, "%a", d); }; - auto printString = [=](const char *descr) { + auto printString = [&](const char *descr) { constexpr qsizetype ChunkSizeLimit = std::numeric_limits::max(); QByteArray indent(nestingLevel * 2, ' '); const char *chunkStr = (reader.isLengthKnown() ? "" : "chunk "); diff --git a/examples/vulkan/hellovulkancubes/mainwindow.cpp b/examples/vulkan/hellovulkancubes/mainwindow.cpp index e84436bb1d..5a41b54152 100644 --- a/examples/vulkan/hellovulkancubes/mainwindow.cpp +++ b/examples/vulkan/hellovulkancubes/mainwindow.cpp @@ -42,7 +42,7 @@ MainWindow::MainWindow(VulkanWindow *vulkanWindow) pauseButton->setFocusPolicy(Qt::NoFocus); connect(quitButton, &QPushButton::clicked, qApp, &QCoreApplication::quit); - connect(newButton, &QPushButton::clicked, vulkanWindow, [=] { + connect(newButton, &QPushButton::clicked, vulkanWindow, [this, &vulkanWindow] { vulkanWindow->addNew(); m_count = vulkanWindow->instanceCount(); counterLcd->display(m_count);