Use QApplication::desktop for screen size on Qt5
5.15 has QWidget::screen, but older versions don't.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -861,9 +861,14 @@ NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) :
|
||||
setMenu (menubar);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
QSize screensize = QApplication::desktop()->size();
|
||||
#else
|
||||
QSize screensize = screen()->size();
|
||||
#endif
|
||||
int x=0,y=0;
|
||||
int w=screen()->size().width()-10; // XXX arbitrary extra space for frame
|
||||
int h=screen()->size().height()-50;
|
||||
int w=screensize.width()-10; // XXX arbitrary extra space for frame
|
||||
int h=screensize.height()-50;
|
||||
|
||||
int maxwn;
|
||||
int maxhn;
|
||||
|
||||
@@ -1133,7 +1133,12 @@ void NetHackQtTextWindow::Display(bool block UNUSED)
|
||||
search.show();
|
||||
rip.hide();
|
||||
}
|
||||
int mh = screen()->size().height()*3/5;
|
||||
#if QT_VERSION < 0x060000
|
||||
QSize screensize = QApplication::desktop()->size();
|
||||
#else
|
||||
QSize screensize = screen()->size();
|
||||
#endif
|
||||
int mh = screensize.height()*3/5;
|
||||
if ( (qt_compact_mode && lines->TotalHeight() > mh) || use_rip ) {
|
||||
// big, so make it fill
|
||||
showMaximized();
|
||||
|
||||
Reference in New Issue
Block a user