View Full Version : QSplashScreen and QWebView

1st November 2011, 17:24
Dear All,

I have an application where the main window consists of various QWebView widgets. When the application starts, a QSplashScreen object is displayed to the user. How can I tell the QSplashScreen object to stay visible until all the html pages are properly loaded in their respective QWebView widgets?

Thanks in advance.

Santosh Reddy
2nd November 2011, 02:13
Does this not work void QSplashScreen::finish ( QWidget (http://www.qtcentre.org/qwidget.html) * mainWin )

2nd November 2011, 05:17
Hi Santosh,

No, it does not work, since QSplashScreen::finish will make the splash screen disappear after the QWebView widgets have been created. This does not however guarantees that the html pages of the relative QWebView widgets have been loaded as well.

Santosh Reddy
2nd November 2011, 05:23
how are you using QSplashScreen?

2nd November 2011, 06:59
Hi Santosh.

I am using QSplashScreen as follows:

#include <QtGui/QApplication>
#include "myapp.h"
#include <QSplashScreen>

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

QSplashScreen *splash = new QSplashScreen(QPixmap(":/myapp/Resources/splash.png"));

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


delete splash;

return app.exec();

Santosh Reddy
2nd November 2011, 07:07
you are deleting the "splash" ! delete it when you are done loading (somewhere in a slot), also either set a parent to "splash" or create it on stack.

I assume QWebView loading is initiated in mainWindow, then have a finishedLoading() signal in mainWindow, and connect it to delteLater() or close() of "splash"