QtGui: code tidies: use the 4-arg connect overload

The 3-arg connect is error-prone and makes the lifetime of the
connection unclear.

Change-Id: I99aa3575a7f901ac52f451f9ef51aa903640d097
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Giuseppe D'Angelo 2023-06-24 12:36:50 +02:00
parent 9e87c3e958
commit d4d91d7131
5 changed files with 6 additions and 6 deletions

View File

@ -621,7 +621,7 @@ bool QKdeThemePrivate::initDbus()
settingChangedHandler(provider, setting, value);
};
return QObject::connect(dbus.get(), &QGenericUnixThemeDBusListener::settingChanged, wrapper);
return QObject::connect(dbus.get(), &QGenericUnixThemeDBusListener::settingChanged, dbus.get(), wrapper);
}
#endif // QT_NO_DBUS
@ -1154,7 +1154,7 @@ bool QGnomeThemePrivate::initDbus()
updateColorScheme(value);
};
return QObject::connect(dbus.get(), &QGenericUnixThemeDBusListener::settingChanged, wrapper);
return QObject::connect(dbus.get(), &QGenericUnixThemeDBusListener::settingChanged, dbus.get(), wrapper);
}
void QGnomeThemePrivate::updateColorScheme(const QString &themeName)

View File

@ -62,7 +62,7 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
}
QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [this](const QPoint &pos) {
connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, this, [this](const QPoint &pos) {
m_x = pos.x();
m_y = pos.y();
clampPosition();

View File

@ -79,7 +79,7 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
m_touch.reset(new QLibInputTouch);
QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [this](const QPoint &pos) {
connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, this, [this](const QPoint &pos) {
m_pointer->setPos(pos);
});

View File

@ -92,7 +92,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
const int focusInDelay = 100;
m_focusInTimer.setSingleShot(true);
m_focusInTimer.setInterval(focusInDelay);
m_focusInTimer.callOnTimeout([]() {
m_focusInTimer.callOnTimeout(this, []() {
// No FocusIn events for us, proceed with FocusOut normally.
QWindowSystemInterface::handleWindowActivated(nullptr, Qt::ActiveWindowFocusReason);
});

View File

@ -104,7 +104,7 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme()
message << "org.freedesktop.portal.FileChooser"_L1 << "version"_L1;
QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall);
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, [d] (QDBusPendingCallWatcher *watcher) {
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, watcher, [d] (QDBusPendingCallWatcher *watcher) {
QDBusPendingReply<QVariant> reply = *watcher;
if (reply.isValid()) {
d->fileChooserPortalVersion = reply.value().toUInt();