summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qpushbutton
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-04-21 20:43:33 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-08-27 20:22:29 +0200
commit2436e259ced39657f22176537603da44ff4e2512 (patch)
tree001b836ef64a242bf12693d0a384e2f5da244862 /tests/auto/widgets/widgets/qpushbutton
parentaccc833e556ba54038d1cc7e261a936492145240 (diff)
Deprecate QApplication::setActiveWindow() and mark as internal
The function is used the internal window activation machinery and should not be called by user code. Many tests still use this function, and should be ported over to QWidget::activateWindow(). For now they are using the private helper in QApplicationPrivate, so that we can progress with the public API deprecation. Change-Id: I29f1575acf9efdcbae4c005ee9b2eb1bb0c8e5b5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/widgets/widgets/qpushbutton')
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt1
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp8
2 files changed, 6 insertions, 3 deletions
diff --git a/tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt b/tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt
index ae126ed058..dee616558c 100644
--- a/tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt
+++ b/tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt
@@ -14,4 +14,5 @@ qt_internal_add_test(tst_qpushbutton
Qt::Gui
Qt::GuiPrivate
Qt::Widgets
+ Qt::WidgetsPrivate
)
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index 172c5878cb..bf06675804 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -19,6 +19,8 @@
#include <private/qguiapplication_p.h>
#include <qpa/qplatformtheme.h>
+#include <QtWidgets/private/qapplication_p.h>
+
class tst_QPushButton : public QObject
{
Q_OBJECT
@@ -336,7 +338,7 @@ void tst_QPushButton::setAccel()
// The shortcut will not be activated unless the button is in a active
// window and has focus
- QApplication::setActiveWindow(testWidget);
+ QApplicationPrivate::setActiveWindow(testWidget);
testWidget->setFocus();
QVERIFY(QTest::qWaitForWindowActive(testWidget));
QTest::keyClick( testWidget, 'A', Qt::AltModifier );
@@ -602,7 +604,7 @@ void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer()
dialog.setLayout(layout);
dialog.show();
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
- QApplication::setActiveWindow(&dialog);
+ QApplicationPrivate::setActiveWindow(&dialog);
// add shortcut '5' to button1 and test with keyboard and keypad '5' keys
QSignalSpy spy1(button1, SIGNAL(clicked()));
@@ -649,7 +651,7 @@ void tst_QPushButton::emitReleasedAfterChange()
dialog.setLayout(layout);
dialog.show();
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
- QApplication::setActiveWindow(&dialog);
+ QApplicationPrivate::setActiveWindow(&dialog);
button1->setFocus();
QSignalSpy spy(button1, SIGNAL(released()));