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

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