summaryrefslogtreecommitdiffstats
path: root/examples/widgets/tools/codecs/mainwindow.cpp
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/tools/codecs/mainwindow.cpp
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/tools/codecs/mainwindow.cpp')
-rw-r--r--examples/widgets/tools/codecs/mainwindow.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/widgets/tools/codecs/mainwindow.cpp b/examples/widgets/tools/codecs/mainwindow.cpp
index 6b601062b6..dc72fa73b7 100644
--- a/examples/widgets/tools/codecs/mainwindow.cpp
+++ b/examples/widgets/tools/codecs/mainwindow.cpp
@@ -54,12 +54,12 @@
#include <QAction>
#include <QApplication>
-#include <QDesktopWidget>
#include <QFileDialog>
#include <QMenuBar>
#include <QMessageBox>
#include <QPlainTextEdit>
#include <QRegularExpression>
+#include <QScreen>
#include <QTextCodec>
#include <QTextStream>
@@ -78,7 +78,7 @@ MainWindow::MainWindow()
setWindowTitle(tr("Codecs"));
- const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
+ const QRect screenGeometry = screen()->geometry();
resize(screenGeometry.width() / 2, screenGeometry.height() * 2 / 3);
}
@@ -216,7 +216,7 @@ void MainWindow::encodingDialog()
{
if (!m_encodingDialog) {
m_encodingDialog = new EncodingDialog(this);
- const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
+ const QRect screenGeometry = screen()->geometry();
m_encodingDialog->setMinimumWidth(screenGeometry.width() / 4);
}
m_encodingDialog->show();