Use QApplication::desktop for screen size on Qt5

5.15 has QWidget::screen, but older versions don't.
This commit is contained in:
Ray Chason
2021-12-29 01:44:02 -05:00
committed by PatR
parent 1f7541e496
commit 1f2a1efee5
3 changed files with 20 additions and 5 deletions

View File

@@ -95,8 +95,13 @@ NetHackQtBind::NetHackQtBind(int& argc, char** argv) :
lsplash->setFixedSize(pm.size());
lsplash->setMask(QBitmap(pm));
}
splash->move((splash->screen()->size().width()-pm.width())/2,
(splash->screen()->size().height()-pm.height())/2);
#if QT_VERSION < 0x060000
QSize screensize = QApplication::desktop()->size();
#else
QSize screensize = splash->screen()->size();
#endif
splash->move((screensize.width()-pm.width())/2,
(screensize.height()-pm.height())/2);
//splash->setGeometry(0,0,100,100);
if ( qt_compact_mode ) {
splash->showMaximized();