根据屏幕大小调整启动时的窗口大小

This commit is contained in:
CalciteM 2019-06-29 15:39:33 +08:00
parent 73d334ee60
commit b3d8c952f3
2 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,6 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
NineChessWindow w;
w.show();
w.move((QApplication::desktop()->width() - w.width()) / 2, (QApplication::desktop()->height() - w.height()) / 2);
w.move((QApplication::desktop()->width() - w.width()) / 4, (QApplication::desktop()->height() - w.height()) / 2);
return a.exec();
}

View File

@ -258,7 +258,8 @@ void NineChessWindow::initialize()
// 更新四个键的状态
on_actionRowChange();
this->resize(QSize(1440, 1440));
int h = QApplication::desktop()->height();
this->resize(QSize(h * 3/4, h * 3/4));
// 窗口最大化
#ifdef SHOW_MAXIMIZED_ON_LOAD