summaryrefslogtreecommitdiffstats
path: root/examples/widgets/mainwindows
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-09-09 16:11:48 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2019-10-15 20:09:29 +0200
commit9cc040a806fd2e6f1458e801a99311168d594c77 (patch)
tree828ca4008a50f44b7b98f7e50f67d01951b4d9ba /examples/widgets/mainwindows
parent92b9dcfe2ba602fc396a4806597b9440ed63bded (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/mainwindows')
-rw-r--r--examples/widgets/mainwindows/application/mainwindow.cpp2
-rw-r--r--examples/widgets/mainwindows/mdi/mainwindow.cpp2
-rw-r--r--examples/widgets/mainwindows/sdi/mainwindow.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/examples/widgets/mainwindows/application/mainwindow.cpp b/examples/widgets/mainwindows/application/mainwindow.cpp
index 7886c4afac..d0c009427f 100644
--- a/examples/widgets/mainwindows/application/mainwindow.cpp
+++ b/examples/widgets/mainwindows/application/mainwindow.cpp
@@ -281,7 +281,7 @@ void MainWindow::readSettings()
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
if (geometry.isEmpty()) {
- const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
+ const QRect availableGeometry = screen()->availableGeometry();
resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
move((availableGeometry.width() - width()) / 2,
(availableGeometry.height() - height()) / 2);
diff --git a/examples/widgets/mainwindows/mdi/mainwindow.cpp b/examples/widgets/mainwindows/mdi/mainwindow.cpp
index b952d19e2e..ccfa7435d7 100644
--- a/examples/widgets/mainwindows/mdi/mainwindow.cpp
+++ b/examples/widgets/mainwindows/mdi/mainwindow.cpp
@@ -464,7 +464,7 @@ void MainWindow::readSettings()
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
if (geometry.isEmpty()) {
- const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
+ const QRect availableGeometry = screen()->availableGeometry();
resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
move((availableGeometry.width() - width()) / 2,
(availableGeometry.height() - height()) / 2);
diff --git a/examples/widgets/mainwindows/sdi/mainwindow.cpp b/examples/widgets/mainwindows/sdi/mainwindow.cpp
index a1fb42158e..c3cd131923 100644
--- a/examples/widgets/mainwindows/sdi/mainwindow.cpp
+++ b/examples/widgets/mainwindows/sdi/mainwindow.cpp
@@ -167,7 +167,7 @@ void MainWindow::tile(const QMainWindow *previous)
if (!topFrameWidth)
topFrameWidth = 40;
const QPoint pos = previous->pos() + 2 * QPoint(topFrameWidth, topFrameWidth);
- if (QApplication::desktop()->availableGeometry(this).contains(rect().bottomRight() + pos))
+ if (screen()->availableGeometry().contains(rect().bottomRight() + pos))
move(pos);
}
@@ -290,7 +290,7 @@ void MainWindow::readSettings()
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
if (geometry.isEmpty()) {
- const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
+ const QRect availableGeometry = screen()->availableGeometry();
resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
move((availableGeometry.width() - width()) / 2,
(availableGeometry.height() - height()) / 2);