PDA

View Full Version : QSplashScreen Question



fuzzylogic
29th October 2011, 10:56
Dear All,

I am using Qt 4.4 on Windows XP. My main window is composed of, among other widgets, by several QWebView widgets that load JavaScript-based graphs. I am using a QSplashScreen in the main class. My problem is that after the QSplashScreen disappears the Main Window appears, however the user cannot interact with since the JavaScript graphs still load in the QWebView widgets. My question is how can I make QSplashScreen disappear only after the QWebView widgets have finished loading the JavaScript graphs? A minimal working example is more than welcome.

Thanks in advance.

tablebubble
29th October 2011, 12:15
You can check the book, C++ GUI programming with Qt4, a good example is there and also, well explained.

fuzzylogic
29th October 2011, 12:29
Thanks for the prompt feedback. Are you referring to the following example?




int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/images/splash.png"));
splash->show();

Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
splash->showMessage(QObject::tr("Setting up the main window..."),
topRight, Qt::white);
MainWindow mainWin;

splash->showMessage(QObject::tr("Loading modules..."),
topRight, Qt::white);
loadModules();

splash->showMessage(QObject::tr("Establishing connections..."),
topRight, Qt::white);
establishConnections();

mainWin.show();
splash->finish(&mainWin);
delete splash;

return app.exec();
}


However, in my case, the corresponding loadModules() and establishConnections() functions are part of the constructor of the mainWin. Any hints?

Thanks again.