summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp14
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp12
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp4
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp10
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp5
6 files changed, 20 insertions, 27 deletions
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index 13dc924f93..54bb8fe0bd 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include <QtWidgets/QDesktopWidget>
+#include <QtGui/QScreen>
#include <QtWidgets/QGraphicsItem>
#include <QtWidgets/QGraphicsScene>
#include <QtWidgets/QGraphicsView>
@@ -617,7 +617,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
QPointF pos = touchWidget.rect().center();
QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint());
QPointF delta(10, 10);
- QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
+ QRectF screenGeometry = touchWidget.screen()->geometry();
QTouchEvent::TouchPoint rawTouchPoint;
rawTouchPoint.setId(0);
@@ -753,7 +753,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QPointF leftScreenPos = leftWidget.mapToGlobal(leftPos.toPoint());
QPointF rightScreenPos = rightWidget.mapToGlobal(rightPos.toPoint());
QPointF centerScreenPos = touchWidget.mapToGlobal(centerPos.toPoint());
- QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
+ QRectF screenGeometry = touchWidget.screen()->geometry();
QList<QTouchEvent::TouchPoint> rawTouchPoints;
rawTouchPoints.append(QTouchEvent::TouchPoint(0));
@@ -968,7 +968,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens()
QPointF pos = touchWidget.rect().center();
QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint());
QPointF delta(10, 10);
- QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
+ QRectF screenGeometry = touchWidget.screen()->geometry();
QVector<QTouchEvent::TouchPoint> rawTouchPoints(3);
rawTouchPoints[0].setId(0);
@@ -1131,7 +1131,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QPointF leftScreenPos = leftWidget.mapToGlobal(leftPos.toPoint());
QPointF rightScreenPos = rightWidget.mapToGlobal(rightPos.toPoint());
QPointF centerScreenPos = touchWidget.mapToGlobal(centerPos.toPoint());
- QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
+ QRectF screenGeometry = touchWidget.screen()->geometry();
QList<QTouchEvent::TouchPoint> rawTouchPoints;
rawTouchPoints.append(QTouchEvent::TouchPoint(0));
@@ -1348,7 +1348,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds()
screenPos << touchWidget.mapToGlobal(pos[i].toPoint());
}
QPointF delta(10, 10);
- QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
+ QRectF screenGeometry = touchWidget.screen()->geometry();
QVector<QPointF> rawPosList;
rawPosList << QPointF(12, 34) << QPointF(56, 78);
@@ -1629,7 +1629,7 @@ void tst_QTouchEvent::deleteInRawEventTranslation()
QPointF leftScreenPos = leftWidget->mapToGlobal(leftPos.toPoint());
QPointF centerScreenPos = centerWidget->mapToGlobal(centerPos.toPoint());
QPointF rightScreenPos = rightWidget->mapToGlobal(rightPos.toPoint());
- QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
+ QRectF screenGeometry = touchWidget.screen()->geometry();
QList<QTouchEvent::TouchPoint> rawTouchPoints;
rawTouchPoints.append(QTouchEvent::TouchPoint(0));
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 0b08586f7d..af0dd9b0f0 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -10977,7 +10977,7 @@ static QList<QTouchEvent::TouchPoint>
tp.setStartScreenPos(screenPos);
tp.setLastScreenPos(screenPos);
tp.setEllipseDiameters(ellipseDiameters);
- const QSizeF screenSize = QApplication::desktop()->screenGeometry(&view).size();
+ const QSizeF screenSize = view.screen()->geometry().size();
tp.setNormalizedPos(QPointF(screenPos.x() / screenSize.width(), screenPos.y() / screenSize.height()));
return QList<QTouchEvent::TouchPoint>() << tp;
}
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 3e372b76f5..40377eb946 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -5383,7 +5383,7 @@ void tst_QWidget::moveChild()
parent.setStyle(style.data());
ColorWidget child(&parent, Qt::Widget, Qt::blue);
- parent.setGeometry(QRect(QPoint(QApplication::desktop()->availableGeometry(&parent).topLeft()) + QPoint(50, 50),
+ parent.setGeometry(QRect(parent.screen()->availableGeometry().topLeft() + QPoint(50, 50),
QSize(200, 200)));
child.setGeometry(25, 25, 50, 50);
#ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting
@@ -5430,8 +5430,7 @@ void tst_QWidget::showAndMoveChild()
const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
parent.setStyle(style.data());
- QDesktopWidget desktop;
- QRect desktopDimensions = desktop.availableGeometry(&parent);
+ QRect desktopDimensions = parent.screen()->availableGeometry();
desktopDimensions = desktopDimensions.adjusted(64, 64, -64, -64);
#ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting
@@ -7708,7 +7707,7 @@ void tst_QWidget::repaintWhenChildDeleted()
#endif
ColorWidget w(nullptr, Qt::FramelessWindowHint, Qt::red);
w.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
- QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
+ QPoint startPoint = w.screen()->availableGeometry().topLeft();
startPoint.rx() += 50;
startPoint.ry() += 50;
w.setGeometry(QRect(startPoint, QSize(100, 100)));
@@ -7733,7 +7732,7 @@ void tst_QWidget::hideOpaqueChildWhileHidden()
{
ColorWidget w(nullptr, Qt::FramelessWindowHint, Qt::red);
w.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
- QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
+ QPoint startPoint = w.screen()->availableGeometry().topLeft();
startPoint.rx() += 50;
startPoint.ry() += 50;
w.setGeometry(QRect(startPoint, QSize(100, 100)));
@@ -9601,8 +9600,7 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779()
palette.setColor(QPalette::Window, Qt::red);
main.setPalette(palette);
- QDesktopWidget desktop;
- QRect desktopDimensions = desktop.availableGeometry(&main);
+ QRect desktopDimensions = main.screen()->availableGeometry();
QSize mainSize(400, 400);
mainSize = mainSize.boundedTo(desktopDimensions.size());
main.resize(mainSize);
diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
index 5a51f15008..27ae41fc4f 100644
--- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
@@ -1765,7 +1765,7 @@ void tst_QCompleter::QTBUG_52028_tabAutoCompletes()
auto le = new QLineEdit;
w.layout()->addWidget(le);
- const auto pos = QApplication::desktop()->availableGeometry(&w).topLeft() + QPoint(200,200);
+ const auto pos = w.screen()->availableGeometry().topLeft() + QPoint(200,200);
w.move(pos);
w.show();
QApplication::setActiveWindow(&w);
@@ -1806,7 +1806,7 @@ void tst_QCompleter::QTBUG_51889_activatedSentTwice()
w.layout()->addWidget(new QLineEdit);
- const auto pos = QApplication::desktop()->availableGeometry(&w).topLeft() + QPoint(200,200);
+ const auto pos = w.screen()->availableGeometry().topLeft() + QPoint(200,200);
w.move(pos);
w.show();
QApplication::setActiveWindow(&w);
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
}
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index d6ba85d61f..417d6e3124 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -34,7 +34,6 @@
#include <qstyle.h>
#include <qproxystyle.h>
#include <qstylefactory.h>
-#include <qdesktopwidget.h>
#include <qaction.h>
#include <qstyleoption.h>
#include <QVBoxLayout>
@@ -1149,8 +1148,8 @@ void tst_QMenuBar::check_menuPosition()
Menu menu;
menu.setTitle("&menu");
- QRect availRect = QApplication::desktop()->availableGeometry(&w);
- QRect screenRect = QApplication::desktop()->screenGeometry(&w);
+ QRect availRect = w.screen()->availableGeometry();
+ QRect screenRect = w.screen()->geometry();
while(menu.sizeHint().height() < (screenRect.height()*2/3)) {
menu.addAction("item");