From ffc0f9ec8a0df0f02c58ab7a22ea607012f58dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Thu, 7 Oct 2021 22:29:17 +0200 Subject: [PATCH] Don't use QDesktopWidget --- YACReaderLibrary/properties_dialog.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/YACReaderLibrary/properties_dialog.cpp b/YACReaderLibrary/properties_dialog.cpp index ef61ec6c..1846820c 100644 --- a/YACReaderLibrary/properties_dialog.cpp +++ b/YACReaderLibrary/properties_dialog.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -51,8 +50,13 @@ PropertiesDialog::PropertiesDialog(QWidget *parent) mainWidget->setLayout(mainLayout); mainLayout->setSizeConstraint(QLayout::SetMinimumSize); - int heightDesktopResolution = QApplication::desktop()->screenGeometry().height(); - int widthDesktopResolution = QApplication::desktop()->screenGeometry().width(); + QScreen *screen = parent != nullptr ? parent->window()->screen() : nullptr; + if (screen == nullptr) { + screen = QApplication::screens().constFirst(); + } + + int heightDesktopResolution = screen->geometry().height(); + int widthDesktopResolution = screen->geometry().width(); int sHeight, sWidth; sHeight = static_cast(heightDesktopResolution * 0.65); sWidth = static_cast(sHeight * 1.4);