summaryrefslogtreecommitdiffstats
path: root/examples/opengl
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-13 21:00:21 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-14 06:38:43 +0200
commit1c76aa077e9c9d74fa2314752948896f9da381ee (patch)
treeef979f532d759c9ae061c400415afd974d3edd26 /examples/opengl
parent772a10391eead51e2c7c9b50473ef0f8096cef82 (diff)
Get rid of all usage of QApplication:desktop
Use QScreen APIs instead. Change-Id: Ie99af94fe4292223dbb165b3f5c1b74e8fe0498b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'examples/opengl')
-rw-r--r--examples/opengl/hellogl2/main.cpp5
-rw-r--r--examples/opengl/hellogl2/window.cpp4
2 files changed, 5 insertions, 4 deletions
diff --git a/examples/opengl/hellogl2/main.cpp b/examples/opengl/hellogl2/main.cpp
index e0cffaf4c2..96b96e77ee 100644
--- a/examples/opengl/hellogl2/main.cpp
+++ b/examples/opengl/hellogl2/main.cpp
@@ -50,6 +50,7 @@
#include <QApplication>
#include <QSurfaceFormat>
+#include <QScreen>
#include <QCommandLineParser>
#include <QCommandLineOption>
@@ -94,8 +95,8 @@ int main(int argc, char *argv[])
mainWindow.setAttribute(Qt::WA_NoSystemBackground, false);
}
mainWindow.resize(mainWindow.sizeHint());
- int desktopArea = QApplication::desktop()->width() *
- QApplication::desktop()->height();
+ int desktopArea = QGuiApplication::primaryScreen()->size().width() *
+ QGuiApplication::primaryScreen()->size().height();
int widgetArea = mainWindow.width() * mainWindow.height();
if (((float)widgetArea / (float)desktopArea) < 0.75f)
mainWindow.show();
diff --git a/examples/opengl/hellogl2/window.cpp b/examples/opengl/hellogl2/window.cpp
index 169f5e59c5..59570c83ca 100644
--- a/examples/opengl/hellogl2/window.cpp
+++ b/examples/opengl/hellogl2/window.cpp
@@ -122,8 +122,8 @@ void Window::dockUndock()
if (parent()) {
setParent(nullptr);
setAttribute(Qt::WA_DeleteOnClose);
- move(QApplication::desktop()->width() / 2 - width() / 2,
- QApplication::desktop()->height() / 2 - height() / 2);
+ move(QGuiApplication::primaryScreen()->size().width() / 2 - width() / 2,
+ QGuiApplication::primaryScreen()->size().height() / 2 - height() / 2);
dockBtn->setText(tr("Dock"));
show();
} else {