I'm trying to show a start-up image using QSplashScreen
and I want to show the image for about 2 seconds.
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();
}
But this is not working. QSplashScreen
appears for some milliseconds and then disappears. Tried to modify the time period but it seems like the QSplashScreen
object is not connected to slot. What's the problem and how to avoid it?