summaryrefslogtreecommitdiff
blob: 9b9b46320fe7af9624bf9f62fee39f35a4ff452d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From 08985f03236a70b35b03b2749cabbd45398e968b Mon Sep 17 00:00:00 2001
From: Alexander Lopatin <alopatindev@gmail.com>
Date: Thu, 16 Jan 2020 11:26:38 +0300
Subject: [PATCH] Fix "error: const QRect QDesktopWidget::screenGeometry(int)
 const is deprecated: Use QGuiApplication::screens()
 [-Werror=deprecated-declarations]" https://bugs.gentoo.org/705438

Signed-off-by: Alexander Lopatin <alopatindev@gmail.com>
---
 qdevicemonitor/ui/MainWindow.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/qdevicemonitor/ui/MainWindow.cpp b/qdevicemonitor/ui/MainWindow.cpp
index 4266de6..69d4433 100644
--- a/qdevicemonitor/ui/MainWindow.cpp
+++ b/qdevicemonitor/ui/MainWindow.cpp
@@ -29,6 +29,7 @@
 #include <QFileInfo>
 #include <QMessageBox>
 #include <QProcess>
+#include <QScreen>
 #include <QSettings>
 #include <QStringList>
 #include <QTabBar>
@@ -181,9 +182,9 @@ void MainWindow::loadSettings()
     {
         setGeometry(geom.toRect());
     }
-    else
+    else if (!qApp->screens().isEmpty())
     {
-        QRect geom = qApp->desktop()->screenGeometry();
+        QRect geom = qApp->screens()[0]->availableVirtualGeometry();
         const int screenWidth = geom.width();
         const int screenHeight = geom.height();
         geom.setWidth(int(screenWidth * 0.7f));
-- 
2.21.0