summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-09-09 16:11:48 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2019-10-15 20:09:29 +0200
commit9cc040a806fd2e6f1458e801a99311168d594c77 (patch)
tree828ca4008a50f44b7b98f7e50f67d01951b4d9ba /tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
parent92b9dcfe2ba602fc396a4806597b9440ed63bded (diff)
Prepare for deprecating the QDesktopWidget
QDesktopWidget is marked as obsolete in docs, but it is not yet completely deprecated, some of its methods are still in use. Replace uses of the following methods marked as obsolete: - QDesktopWidget::screenNumber(QWidget*) -> QWidget::screen() - QDesktopWidget::screenGeometry(QWidget*) -> QWidget::screen()->geometry() - QDesktopWidget::availableGeometry(QWidget*) -> QWidget::screen()->availableGeometry() Task-number: QTBUG-76491 Change-Id: I2cca30f2b4caa6e6848e8190e09f959d2c272f33 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp')
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 4e16edaca8..b7869a0653 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -34,7 +34,6 @@
#include <qpa/qplatformtheme.h>
#include <qfontcombobox.h>
-#include <qdesktopwidget.h>
#include <qapplication.h>
#include <qpushbutton.h>
#include <qdialog.h>
@@ -2212,15 +2211,13 @@ void tst_QComboBox::itemListPosition()
QFontComboBox combo(&topLevel);
layout->addWidget(&combo);
- //the code to get the available screen space is copied from QComboBox code
- const int scrNumber = QApplication::desktop()->screenNumber(&combo);
bool useFullScreenForPopupMenu = false;
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool();
const QRect screen = useFullScreenForPopupMenu ?
- QApplication::screens().at(scrNumber)->geometry() :
- QApplication::screens().at(scrNumber)->availableGeometry();
+ combo.screen()->geometry() :
+ combo.screen()->availableGeometry();
topLevel.move(screen.width() - topLevel.sizeHint().width() - 10, 0); //puts the combo to the top-right corner
@@ -2440,8 +2437,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize()
#if defined QT_BUILD_INTERNAL
QFrame *container = comboBox.findChild<QComboBoxPrivateContainer *>();
QVERIFY(container);
- QDesktopWidget desktop;
- QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry()));
+ QTRY_VERIFY(container->screen()->geometry().contains(container->geometry()));
#endif
}