diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-09-09 16:11:48 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-10-15 20:09:29 +0200 |
commit | 9cc040a806fd2e6f1458e801a99311168d594c77 (patch) | |
tree | 828ca4008a50f44b7b98f7e50f67d01951b4d9ba /examples/widgets/dialogs | |
parent | 92b9dcfe2ba602fc396a4806597b9440ed63bded (diff) |
Prepare for deprecating the QDesktopWidget
QDesktopWidget is marked as obsolete in docs, but it is not yet
completely deprecated, some of its methods are still in use.
Replace uses of the following methods marked as obsolete:
- QDesktopWidget::screenNumber(QWidget*) -> QWidget::screen()
- QDesktopWidget::screenGeometry(QWidget*) -> QWidget::screen()->geometry()
- QDesktopWidget::availableGeometry(QWidget*) -> QWidget::screen()->availableGeometry()
Task-number: QTBUG-76491
Change-Id: I2cca30f2b4caa6e6848e8190e09f959d2c272f33
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'examples/widgets/dialogs')
-rw-r--r-- | examples/widgets/dialogs/standarddialogs/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/widgets/dialogs/standarddialogs/main.cpp b/examples/widgets/dialogs/standarddialogs/main.cpp index f7417f0e45..19ed2bf66f 100644 --- a/examples/widgets/dialogs/standarddialogs/main.cpp +++ b/examples/widgets/dialogs/standarddialogs/main.cpp @@ -49,8 +49,8 @@ ****************************************************************************/ #include <QApplication> +#include <QScreen> #include <QStyleHints> -#include <QDesktopWidget> #include <QTranslator> #include <QLocale> #include <QLibraryInfo> @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) Dialog dialog; if (!QGuiApplication::styleHints()->showIsFullScreen() && !QGuiApplication::styleHints()->showIsMaximized()) { - const QRect availableGeometry = QApplication::desktop()->availableGeometry(&dialog); + const QRect availableGeometry = dialog.screen()->availableGeometry(); dialog.resize(availableGeometry.width() / 3, availableGeometry.height() * 2 / 3); dialog.move((availableGeometry.width() - dialog.width()) / 2, (availableGeometry.height() - dialog.height()) / 2); |