我正在尝试使用显示启动图像,QSplashScreen
并且我想显示图像约 2 秒钟。
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QPixmap pixmap(":/images/usm.png");
QSplashScreen splash(pixmap);
splash.show();
splash.showMessage("Loading Processes");
QTimer::singleShot(2000, &splash, SLOT(close()));
MainWindow w;
w.show();
splash.finish(&w);
return a.exec();
}
但这不起作用。QSplashScreen
出现几毫秒然后消失。尝试修改时间段,但对象似乎QSplashScreen
未连接到插槽。有什么问题以及如何避免它?