The QSplashScreen widget provides a splash screen that can be shown during application startup.
.PP
A splash screen is a widget that is usually displayed when an application is being started. Splash screens are often used for applications that have long start up times (e.g. database or networking applications that take time to establish connections) to provide the user with feedback that the application is loading.
.PP
The splash screen appears centered on the screen. It may be useful to add the WStyle_StaysOnTop if you desire to keep above all the windows in the GUI.
.PP
Some X11 window managers do not support the "stays on top" flag. A solution is to set up a timer that periodically calls raise() on the splash screen to simulate the "stays on top" effect.
.PP
The most common usage is to show a splash screen before the main widget is displayed on the screen. This is illustrated in the following code snippet.
.PP
.nf
.br
int main( int argc, char **argv )
.br
{
.br
QApplication app( argc, argv );
.br
QPixmap pixmap( "splash.png" );
.br
QSplashScreen *splash = new QSplashScreen( pixmap );
.br
splash->show();
.br
QMainWindow *mainWin = new QMainWindow;
.br
...
.br
app.setMainWidget( mainWin );
.br
mainWin->show();
.br
splash->finish( mainWin );
.br
delete splash;
.br
return app.exec();
.br
}
.br
.fi
.PP
It is sometimes useful to update the splash screen with messages, for example, announcing connections established or modules loaded as the application starts up. QSplashScreen supports this with the message() function. If you wish to do your own drawing you can get a pointer to the pixmap used in the splash screen with pixmap(). Alternatively, you can subclass QSplashScreen and reimplement drawContents().
.PP
The user can hide the splash screen by clicking on it with the mouse. Since the splash screen is typically displayed before the event loop has started running, it is necessary to periodically call QApplication::processEvents() to receive the mouse clicks.
.PP
.nf
.br
QPixmap pixmap( "splash.png" );
.br
QSplashScreen *splash = new QSplashScreen( pixmap );
Draw the contents of the splash screen using painter \fIpainter\fR. The default implementation draws the message passed by message(). Reimplement this function if you want to do your own drawing on the splash screen.
This signal is emitted when the message on the splash screen changes. \fImessage\fR is the new message and is a null-string when the message has been removed.
.PP
See also message() and clear().
.SH "QPixmap * QSplashScreen::pixmap () const"
Returns the pixmap that is used in the splash screen. The image does not have any of the text drawn by message() calls.
.SH "void QSplashScreen::repaint ()"
This overrides QWidget::repaint(). It differs from the standard repaint function in that it also calls QApplication::flush() to ensure the updates are displayed, even when there is no event loop present.