summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2019-10-17 09:41:36 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2019-10-17 09:41:36 +0200
commit02164e0288f714f1ea93afb32548548686773d1d (patch)
treed7ed16267f7659af63e78c8de8915ed0208b598b /tests/manual
parent4a7e7103e713448c05d9d30cab8b7e52406b46a6 (diff)
parent6f27bb135246b7fe9d11ba58e05d2b7661bc2080 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/dialogs/printdialogpanel.cpp3
-rw-r--r--tests/manual/qcursor/qcursorhighdpi/main.cpp11
-rw-r--r--tests/manual/qdesktopwidget/main.cpp2
-rw-r--r--tests/manual/qscreen/main.cpp5
4 files changed, 11 insertions, 10 deletions
diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp
index 8d64d2f6a6..b7447e3d64 100644
--- a/tests/manual/dialogs/printdialogpanel.cpp
+++ b/tests/manual/dialogs/printdialogpanel.cpp
@@ -710,8 +710,7 @@ void PrintDialogPanel::showPreviewDialog()
applySettings(m_printer.data());
PrintPreviewDialog dialog(m_printer.data(), this);
#if QT_VERSION >= 0x050000
- const int screenNumber = QApplication::desktop()->screenNumber(this);
- const QSize availableSize = QGuiApplication::screens().at(screenNumber)->availableSize();
+ const QSize availableSize = screen()->availableSize();
#else
const QSize availableSize = QApplication::desktop()->availableGeometry().size();
#endif
diff --git a/tests/manual/qcursor/qcursorhighdpi/main.cpp b/tests/manual/qcursor/qcursorhighdpi/main.cpp
index 3b18bff91c..e70be333fd 100644
--- a/tests/manual/qcursor/qcursorhighdpi/main.cpp
+++ b/tests/manual/qcursor/qcursorhighdpi/main.cpp
@@ -218,7 +218,7 @@ protected:
VerticalRuler::VerticalRuler(QWidget *parent) : QWidget(parent)
{
- const int screenWidth = QApplication::desktop()->screenGeometry(this).width();
+ const int screenWidth = screen()->geometry().width();
setFixedWidth(screenWidth / 48); // 1920 pixel monitor ->40
}
@@ -356,15 +356,12 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
MainWindowPtrList windows;
-
- QDesktopWidget *desktopWidget = app.desktop();
-
const int lastScreen = arguments.contains("-p")
? 0 // Primary screen only
- : desktopWidget->screenCount() - 1; // All screens
+ : QGuiApplication::screens().size() - 1; // All screens
for (int s = lastScreen; s >= 0; --s) {
- MainWindowPtr window(new MainWindow(desktopWidget->screen(s)));
- const QPoint pos = desktopWidget->screenGeometry(s).center() - QPoint(200, 100);
+ MainWindowPtr window(new MainWindow());
+ const QPoint pos = QGuiApplication::screens().at(s)->geometry().center() - QPoint(200, 100);
window->move(pos);
windows.append(window);
window->show();
diff --git a/tests/manual/qdesktopwidget/main.cpp b/tests/manual/qdesktopwidget/main.cpp
index f4c82c5f72..978dc62b0e 100644
--- a/tests/manual/qdesktopwidget/main.cpp
+++ b/tests/manual/qdesktopwidget/main.cpp
@@ -34,6 +34,7 @@
class DesktopView : public QGraphicsView
{
+#if QT_DEPRECATED_SINCE(5, 11)
Q_OBJECT
public:
DesktopView()
@@ -195,6 +196,7 @@ private:
QGraphicsScene *scene;
QGraphicsRectItem *that;
QPoint thatRoot;
+#endif
};
#include "main.moc"
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index 6fba872b12..0728d66bf9 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -61,8 +61,10 @@ public:
QLatin1String("Left-click to test QGuiApplication::topLevelAt(click pos)\nRight-click to ungrab\n") :
QLatin1String("Left-click to grab mouse\n");
if (!m_cursorPos.isNull()) {
+ const auto screen = QGuiApplication::screenAt(m_cursorPos);
+ const auto screenNum = screen ? QGuiApplication::screens().indexOf(screen) : 0;
txt += QString(QLatin1String("Current mouse position: %1, %2 on screen %3\n"))
- .arg(m_cursorPos.x()).arg(m_cursorPos.y()).arg(QApplication::desktop()->screenNumber(m_cursorPos));
+ .arg(m_cursorPos.x()).arg(m_cursorPos.y()).arg(screenNum);
if (QGuiApplication::mouseButtons() & Qt::LeftButton) {
QWindow *win = QGuiApplication::topLevelAt(m_cursorPos);
txt += QString(QLatin1String("Top-level window found? %1\n"))
@@ -234,6 +236,7 @@ void screenAdded(QScreen* screen)
QList<QScreen *> screens = QGuiApplication::screens();
int screenNumber = screens.indexOf(screen);
Q_ASSERT(screenNumber >= 0);
+ // ### Qt 6: Find a replacement for QDesktopWidget::screen()
w->setParent(qApp->desktop()->screen(screenNumber));
w->show();