From acc629c1e82d19a4153bf2db821f2a34fb1e94a3 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 24 Mar 2018 17:24:16 +0100 Subject: Examples: replace QDesktopWidget::availableGeometry()/screenGeometry() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QDesktopWidget::availableGeometry()/screenGeometry() was deprecated in 5.11 and replaced with QScreen::availableGeometry()/screenGeometry() Change-Id: I912a133971c41196f8f49754c28ce92711ff42bb Reviewed-by: Martin Smith Reviewed-by: Topi Reiniƶ --- examples/corelib/threads/queuedcustomtype/window.cpp | 3 +-- examples/widgets/painting/deform/pathdeform.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/corelib/threads/queuedcustomtype/window.cpp b/examples/corelib/threads/queuedcustomtype/window.cpp index 7b9004d868..2cefba1e17 100644 --- a/examples/corelib/threads/queuedcustomtype/window.cpp +++ b/examples/corelib/threads/queuedcustomtype/window.cpp @@ -108,9 +108,8 @@ void Window::loadImage() void Window::loadImage(const QImage &image) { - QDesktopWidget desktop; QImage useImage; - QRect space = desktop.availableGeometry(); + QRect space = QGuiApplication::primaryScreen()->availableGeometry(); if (image.width() > 0.75*space.width() || image.height() > 0.75*space.height()) useImage = image.scaled(0.75*space.width(), 0.75*space.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); diff --git a/examples/widgets/painting/deform/pathdeform.cpp b/examples/widgets/painting/deform/pathdeform.cpp index 490a8508d6..cfbbdb7e8e 100644 --- a/examples/widgets/painting/deform/pathdeform.cpp +++ b/examples/widgets/painting/deform/pathdeform.cpp @@ -50,7 +50,8 @@ #include "pathdeform.h" -#include +#include +#include #include #include #include @@ -247,7 +248,7 @@ void PathDeformControls::layoutForSmallScreen() deformSlider->setValue(80); fontSizeSlider->setValue(120); - QRect screen_size = QApplication::desktop()->screenGeometry(); + QRect screen_size = QGuiApplication::primaryScreen()->geometry(); radiusSlider->setValue(qMin(screen_size.width(), screen_size.height())/5); m_renderer->setText(tr("Qt")); @@ -277,7 +278,7 @@ PathDeformWidget::PathDeformWidget(QWidget *parent, bool smallScreen) connect(m_renderer, SIGNAL(clicked()), this, SLOT(showControls())); connect(m_controls, SIGNAL(okPressed()), this, SLOT(hideControls())); - connect(m_controls, SIGNAL(quitPressed()), QApplication::instance(), SLOT(quit())); + connect(m_controls, SIGNAL(quitPressed()), QCoreApplication::instance(), SLOT(quit())); } -- cgit v1.2.3