summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/desktop/screenshot/main.cpp5
-rw-r--r--examples/widgets/desktop/screenshot/screenshot.cpp2
-rw-r--r--examples/widgets/dialogs/standarddialogs/main.cpp4
-rw-r--r--examples/widgets/itemviews/dirview/main.cpp4
-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
-rw-r--r--examples/widgets/richtext/textedit/main.cpp4
-rw-r--r--examples/widgets/tools/codecs/mainwindow.cpp6
-rw-r--r--examples/widgets/tools/codecs/previewform.cpp4
-rw-r--r--examples/widgets/tools/settingseditor/mainwindow.cpp4
-rw-r--r--examples/widgets/tools/settingseditor/settingstree.cpp4
-rw-r--r--examples/widgets/widgets/charactermap/mainwindow.cpp3
-rw-r--r--examples/widgets/widgets/icons/main.cpp4
14 files changed, 27 insertions, 25 deletions
diff --git a/examples/widgets/desktop/screenshot/main.cpp b/examples/widgets/desktop/screenshot/main.cpp
index 825c40b236..96b0d57daa 100644
--- a/examples/widgets/desktop/screenshot/main.cpp
+++ b/examples/widgets/desktop/screenshot/main.cpp
@@ -49,7 +49,7 @@
****************************************************************************/
#include <QApplication>
-#include <QDesktopWidget>
+#include <QScreen>
#include "screenshot.h"
@@ -58,7 +58,8 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
Screenshot screenshot;
- screenshot.move(QApplication::desktop()->availableGeometry(&screenshot).topLeft() + QPoint(20, 20));
+ screenshot.move(screenshot.screen()->availableGeometry().topLeft() + QPoint(20, 20));
screenshot.show();
+
return app.exec();
}
diff --git a/examples/widgets/desktop/screenshot/screenshot.cpp b/examples/widgets/desktop/screenshot/screenshot.cpp
index 715e6c780e..ce5597bbdd 100644
--- a/examples/widgets/desktop/screenshot/screenshot.cpp
+++ b/examples/widgets/desktop/screenshot/screenshot.cpp
@@ -59,7 +59,7 @@ Screenshot::Screenshot()
screenshotLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
screenshotLabel->setAlignment(Qt::AlignCenter);
- const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
+ const QRect screenGeometry = screen()->geometry();
screenshotLabel->setMinimumSize(screenGeometry.width() / 8, screenGeometry.height() / 8);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
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);
diff --git a/examples/widgets/itemviews/dirview/main.cpp b/examples/widgets/itemviews/dirview/main.cpp
index 9fecffda40..fcdf4c7ba4 100644
--- a/examples/widgets/itemviews/dirview/main.cpp
+++ b/examples/widgets/itemviews/dirview/main.cpp
@@ -49,9 +49,9 @@
****************************************************************************/
#include <QApplication>
-#include <QDesktopWidget>
#include <QFileSystemModel>
#include <QFileIconProvider>
+#include <QScreen>
#include <QTreeView>
#include <QCommandLineParser>
#include <QCommandLineOption>
@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
tree.setAnimated(false);
tree.setIndentation(20);
tree.setSortingEnabled(true);
- const QSize availableSize = QApplication::desktop()->availableGeometry(&tree).size();
+ const QSize availableSize = tree.screen()->availableGeometry().size();
tree.resize(availableSize / 2);
tree.setColumnWidth(0, tree.width() / 3);
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);
diff --git a/examples/widgets/richtext/textedit/main.cpp b/examples/widgets/richtext/textedit/main.cpp
index aef186aa77..256d183811 100644
--- a/examples/widgets/richtext/textedit/main.cpp
+++ b/examples/widgets/richtext/textedit/main.cpp
@@ -51,9 +51,9 @@
#include "textedit.h"
#include <QApplication>
-#include <QDesktopWidget>
#include <QCommandLineParser>
#include <QCommandLineOption>
+#include <QScreen>
int main(int argc, char *argv[])
{
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
TextEdit mw;
- const QRect availableGeometry = QApplication::desktop()->availableGeometry(&mw);
+ const QRect availableGeometry = mw.screen()->availableGeometry();
mw.resize(availableGeometry.width() / 2, (availableGeometry.height() * 2) / 3);
mw.move((availableGeometry.width() - mw.width()) / 2,
(availableGeometry.height() - mw.height()) / 2);
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();
diff --git a/examples/widgets/tools/codecs/previewform.cpp b/examples/widgets/tools/codecs/previewform.cpp
index ec75ebb9fa..f48651335a 100644
--- a/examples/widgets/tools/codecs/previewform.cpp
+++ b/examples/widgets/tools/codecs/previewform.cpp
@@ -52,12 +52,12 @@
#include <QApplication>
#include <QComboBox>
-#include <QDesktopWidget>
#include <QDialogButtonBox>
#include <QGridLayout>
#include <QLabel>
#include <QPlainTextEdit>
#include <QPushButton>
+#include <QScreen>
#include <QTextCodec>
#include <QTextStream>
@@ -183,7 +183,7 @@ PreviewForm::PreviewForm(QWidget *parent)
mainLayout->addWidget(statusLabel, 2, 0, 1, 2);
mainLayout->addWidget(buttonBox, 3, 0, 1, 2);
- const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
+ const QRect screenGeometry = screen()->geometry();
resize(screenGeometry.width() * 2 / 5, screenGeometry.height() / 2);
}
diff --git a/examples/widgets/tools/settingseditor/mainwindow.cpp b/examples/widgets/tools/settingseditor/mainwindow.cpp
index b9c2193ccb..ccca16ffcd 100644
--- a/examples/widgets/tools/settingseditor/mainwindow.cpp
+++ b/examples/widgets/tools/settingseditor/mainwindow.cpp
@@ -54,12 +54,12 @@
#include <QAction>
#include <QApplication>
-#include <QDesktopWidget>
#include <QFileDialog>
#include <QInputDialog>
#include <QLineEdit>
#include <QMenuBar>
#include <QMessageBox>
+#include <QScreen>
#include <QStandardPaths>
#include <QStatusBar>
@@ -74,7 +74,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
fallbacksAct->setChecked(true);
setWindowTitle(QCoreApplication::applicationName());
- const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
+ const QRect availableGeometry = screen()->availableGeometry();
adjustSize();
move((availableGeometry.width() - width()) / 2, (availableGeometry.height() - height()) / 2);
}
diff --git a/examples/widgets/tools/settingseditor/settingstree.cpp b/examples/widgets/tools/settingseditor/settingstree.cpp
index b263746847..49d299bf72 100644
--- a/examples/widgets/tools/settingseditor/settingstree.cpp
+++ b/examples/widgets/tools/settingseditor/settingstree.cpp
@@ -52,8 +52,8 @@
#include "variantdelegate.h"
#include <QApplication>
-#include <QDesktopWidget>
#include <QHeaderView>
+#include <QScreen>
#include <QSettings>
SettingsTree::SettingsTree(QWidget *parent)
@@ -93,7 +93,7 @@ void SettingsTree::setSettingsObject(const SettingsPtr &newSettings)
QSize SettingsTree::sizeHint() const
{
- const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
+ const QRect availableGeometry = screen()->availableGeometry();
return QSize(availableGeometry.width() * 2 / 3, availableGeometry.height() * 2 / 3);
}
diff --git a/examples/widgets/widgets/charactermap/mainwindow.cpp b/examples/widgets/widgets/charactermap/mainwindow.cpp
index 25c4503ddb..b0f9705c21 100644
--- a/examples/widgets/widgets/charactermap/mainwindow.cpp
+++ b/examples/widgets/widgets/charactermap/mainwindow.cpp
@@ -64,6 +64,7 @@
#include <QMenuBar>
#include <QPlainTextEdit>
#include <QPushButton>
+#include <QScreen>
#include <QScrollArea>
#include <QStatusBar>
#include <QTextStream>
@@ -302,7 +303,7 @@ QString FontInfoDialog::text() const
void MainWindow::showInfo()
{
- const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
+ const QRect screenGeometry = screen()->geometry();
FontInfoDialog *dialog = new FontInfoDialog(this);
dialog->setWindowTitle(tr("Fonts"));
dialog->setAttribute(Qt::WA_DeleteOnClose);
diff --git a/examples/widgets/widgets/icons/main.cpp b/examples/widgets/widgets/icons/main.cpp
index a045ea765a..632795c18c 100644
--- a/examples/widgets/widgets/icons/main.cpp
+++ b/examples/widgets/widgets/icons/main.cpp
@@ -50,7 +50,7 @@
#include <QApplication>
#include <QCommandLineParser>
-#include <QDesktopWidget>
+#include <QScreen>
#include "mainwindow.h"
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
if (!commandLineParser.positionalArguments().isEmpty())
mainWin.loadImages(commandLineParser.positionalArguments());
- const QRect availableGeometry = QApplication::desktop()->availableGeometry(&mainWin);
+ const QRect availableGeometry = mainWin.screen()->availableGeometry();
mainWin.resize(availableGeometry.width() / 2, availableGeometry.height() * 2 / 3);
mainWin.move((availableGeometry.width() - mainWin.width()) / 2, (availableGeometry.height() - mainWin.height()) / 2);