diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/opengl/hellogl2/main.cpp | 5 | ||||
-rw-r--r-- | examples/opengl/hellogl2/window.cpp | 4 |
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 { |