From 390ce392c815523e8dd609d26d7c74bcc81647b6 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 13 Feb 2023 21:59:45 +0000 Subject: [PATCH] Fix connections in QWidgetWindow A recent update moved handleScreenChange out of being a private slot. Porting to the new syntax fixes the warning and moves to a compile-time check. Change-Id: Ibd85c6caf7dca051d669250a94a82fbddbd3435d Reviewed-by: Volker Hilsheimer (cherry picked from commit ec8e6ed20034a5ea7d32bdc62b3b9dc91ce68d36) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/kernel/qwidgetwindow.cpp | 2 +- .../widgets/kernel/qwidget_window/tst_qwidget_window.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 7a3c38bb8d1..76c77e6e27e 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -129,7 +129,7 @@ QWidgetWindow::QWidgetWindow(QWidget *widget) } connect(widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName); - connect(this, SIGNAL(screenChanged(QScreen*)), this, SLOT(handleScreenChange())); + connect(this, &QWidgetWindow::screenChanged, this, &QWidgetWindow::handleScreenChange); } QWidgetWindow::~QWidgetWindow() diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 3211edbb332..addcc7d321f 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -53,6 +53,7 @@ public: tst_QWidget_window(); public slots: + void init(); void initTestCase(); void cleanupTestCase(); void cleanup(); @@ -129,6 +130,11 @@ void tst_QWidget_window::initTestCase() { } +void tst_QWidget_window::init() +{ + QTest::failOnWarning(QRegularExpression(".*No such slot.*")); +} + void tst_QWidget_window::cleanupTestCase() { }