From 1c76aa077e9c9d74fa2314752948896f9da381ee Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 13 Oct 2020 21:00:21 +0200 Subject: Get rid of all usage of QApplication:desktop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use QScreen APIs instead. Change-Id: Ie99af94fe4292223dbb165b3f5c1b74e8fe0498b Reviewed-by: Tor Arne Vestbø Reviewed-by: Qt CI Bot --- tests/manual/qscreen/main.cpp | 7 +------ tests/manual/widgets/kernel/setscreen/main.cpp | 23 ----------------------- 2 files changed, 1 insertion(+), 29 deletions(-) (limited to 'tests/manual') diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp index fced21f307..ec2203e1f1 100644 --- a/tests/manual/qscreen/main.cpp +++ b/tests/manual/qscreen/main.cpp @@ -228,12 +228,7 @@ void screenAdded(QScreen* screen) (screen->virtualSiblings().isEmpty() ? "none" : qPrintable(screen->virtualSiblings().first()->name()))); ScreenWatcherMainWindow *w = new ScreenWatcherMainWindow(screen); - // Set the screen; this corresponds to setScreen() for the underlying - // QWindow. This is essential when having separate X screens since the - // positioning below is not sufficient to get the windows show up on the - // desired screen. - w->setParent(qApp->desktop(screen)); - + w->setScreen(screen); w->show(); // Position the windows so that they end up at the center of the corresponding screen. diff --git a/tests/manual/widgets/kernel/setscreen/main.cpp b/tests/manual/widgets/kernel/setscreen/main.cpp index 70ec067d3d..a8b9a6585a 100644 --- a/tests/manual/widgets/kernel/setscreen/main.cpp +++ b/tests/manual/widgets/kernel/setscreen/main.cpp @@ -68,18 +68,12 @@ public: screenButton->setEnabled(false); connect(screenButton, &QAbstractButton::clicked, this, &Controller::setScreen); - QPushButton *desktopButton = new QPushButton; - desktopButton->setText("Show on Desktop"); - desktopButton->setEnabled(false); - connect(desktopButton, &QAbstractButton::clicked, this, &Controller::setDesktop); - QPushButton *exitButton = new QPushButton; exitButton->setText("E&xit"); connect(exitButton, &QAbstractButton::clicked, QApplication::instance(), &QCoreApplication::quit); QHBoxLayout *actionLayout = new QHBoxLayout; actionLayout->addWidget(screenButton); - actionLayout->addWidget(desktopButton); actionLayout->addWidget(exitButton); QGroupBox *radioGroup = new QGroupBox; @@ -95,7 +89,6 @@ public: if (on) targetScreen = count; screenButton->setEnabled(targetScreen != -1); - desktopButton->setEnabled(targetScreen != -1); }); groupLayout->addWidget(choice); ++count; @@ -122,24 +115,8 @@ private slots: widget->updateText(); } - void setDesktop() - { - QScreen *screen = QGuiApplication::screens().at(targetScreen); - QWidget *desktop = QApplication::desktop(screen); - if (!desktopChild) { - desktopChild = new ScreenWidget(desktop); - desktopChild->setAttribute(Qt::WA_DeleteOnClose); - desktopChild->setWindowTitle("Child of a Desktop"); - } else { - desktopChild->setParent(desktop); - } - desktopChild->show(); - desktopChild->updateText(); - } - private: QPointer widget = nullptr; - QPointer desktopChild = nullptr; int targetScreen = -1; }; -- cgit v1.2.3