QTimer: fix compilation with C++20

Implicit capture of *this by [=] is deprecated in C++20, and the
replacement [=,this] is not available in C++17. We also can't use [&],
because of QueuedConnection, so need to bite the bullet and list all
captured variables separately.

Amends 87535e4e4337596066258e361143cb9906e89512.

Change-Id: I5b3a713bf9220746d10d594d1a248028157ad170
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Marc Mutz 2023-05-02 11:14:36 +02:00
parent 51bcad8a61
commit 106c2fd19d

View File

@ -303,7 +303,7 @@ void QSingleShotTimer::startTimerForReceiver(int msec, Qt::TimerType timerType,
moveToThread(receiver->thread());
QDeadlineTimer deadline(std::chrono::milliseconds{msec}, timerType);
QMetaObject::invokeMethod(this, [=]{
QMetaObject::invokeMethod(this, [this, deadline, timerType]{
if (deadline.hasExpired())
emit timeout();
else