Fix deprecated in GUI utility class

This commit is contained in:
Klaus Basan
2020-01-01 22:57:11 +01:00
committed by Mat Sutcliffe
parent f8e8318902
commit 7d068cf979
2 changed files with 4 additions and 8 deletions

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>260</width>
<width>300</width>
<height>367</height>
</rect>
</property>
@@ -159,9 +159,6 @@
<property name="readOnly">
<bool>true</bool>
</property>
<property name="tabStopWidth">
<number>10</number>
</property>
</widget>
</item>
</layout>
@@ -200,9 +197,6 @@
<property name="readOnly">
<bool>true</bool>
</property>
<property name="tabStopWidth">
<number>10</number>
</property>
</widget>
</item>
</layout>

View File

@@ -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);