From 7d068cf97971e1b41ed8a8c172774486961561ae Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 1 Jan 2020 22:57:11 +0100 Subject: [PATCH] Fix deprecated in GUI utility class --- src/blackgui/components/textmessagecomponent.ui | 8 +------- src/blackgui/guiutility.cpp | 4 +++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/blackgui/components/textmessagecomponent.ui b/src/blackgui/components/textmessagecomponent.ui index 15299833b..98749e5c9 100644 --- a/src/blackgui/components/textmessagecomponent.ui +++ b/src/blackgui/components/textmessagecomponent.ui @@ -6,7 +6,7 @@ 0 0 - 260 + 300 367 @@ -159,9 +159,6 @@ true - - 10 - @@ -200,9 +197,6 @@ true - - 10 - diff --git a/src/blackgui/guiutility.cpp b/src/blackgui/guiutility.cpp index 6fae3ad13..b82fce791 100644 --- a/src/blackgui/guiutility.cpp +++ b/src/blackgui/guiutility.cpp @@ -690,7 +690,9 @@ namespace BlackGui void CGuiUtility::centerWidget(QWidget *widget) { - const QRect screenGeometry = QApplication::desktop()->screenGeometry(); + // const QRect screenGeometry = QApplication::desktop()->screenGeometry(); + const QScreen *pScreen = QGuiApplication::screenAt(widget->mapToGlobal({widget->width() / 2, 0})); + const QRect screenGeometry = pScreen->availableGeometry(); const int x = (screenGeometry.width() - widget->width()) / 2; const int y = (screenGeometry.height() - widget->height()) / 2; widget->move(x, y);