int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//获取某个环境变量的值
QString path = QProcessEnvironment::systemEnvironment().value("QT_DATA_PATH").replace("\\","/");
//获取屏幕大小
QDesktopWidget * deskWgt = QApplication::desktop();
QRect applicationRect = deskWgt->screenGeometry(); //带任务栏
QRect screenRect = deskWgt->availableGeometry(); //不带任务栏
MainScreen mm; //主屏
SecondScreen ss; //副屏幕
QDesktopWidget * desktop = QApplication::desktop();
int count = desktop->screenCount();
if(count > 1)
{
QRect mainRect = desktop->screenGeometry(0);
mm.setGeometry(mainRect);
mm.showFullScreen();
QRect secondRect = desktop->screenGeometry(1);
ss.setGeometry(secondRect);
ss.showFullScreen();
}
else
{
mm.showFullScreen();
ss.showFullScreen();
}
return a.exec();
}
单双屏显示
于 2023-08-23 11:22:27 首次发布