QApplication a(argc, argv);
//......
//多屏情况下选择主屏
QDesktopWidget* desktop = QApplication::desktop();
QRect curScreenRect = desktop->screenGeometry(0);
//启动动画(适当调整)
QPixmap pixmap(PROGRAM_START_ANIMATION);
QSplashScreen splash(pixmap.scaled(curScreenRect.width()/4,curScreenRect.height()*3/10),
Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint);
splash.setGeometry(curScreenRect.width()*3/8,curScreenRect.height()/4,
curScreenRect.width()/4,curScreenRect.height()*3/10);
splash.move((curScreenRect.width() - splash.width()) / 2,
(curScreenRect.height() - splash.height()) / 2);
splash.show();
a.processEvents();
//......
//主程序 (将splash传入主窗口中,等到所有模块都加载完毕后,可调用splash.finish(...)弹出主窗口)
MainWindow w(&splash);
return a.exec();
2.启动动画
最新推荐文章于 2021-12-05 12:27:03 发布