<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qsplashscreen.cpp:53 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QSplashScreen Class</title> <style type="text/css"><!-- fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td valign=center> <a href="index.html"> <font color="#004faf">Home</font></a> | <a href="classes.html"> <font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QSplashScreen Class Reference</h1> <p>The QSplashScreen widget provides a splash screen that can be shown during application startup. <a href="#details">More...</a> <p><tt>#include <<a href="qsplashscreen-h.html">qsplashscreen.h</a>></tt> <p>Inherits <a href="qwidget.html">QWidget</a>. <p><a href="qsplashscreen-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li class=fn><a href="#QSplashScreen"><b>QSplashScreen</b></a> ( const QPixmap & pixmap = QPixmap ( ), WFlags f = 0 )</li> <li class=fn>virtual <a href="#~QSplashScreen"><b>~QSplashScreen</b></a> ()</li> <li class=fn>void <a href="#setPixmap"><b>setPixmap</b></a> ( const QPixmap & pixmap )</li> <li class=fn>QPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</li> <li class=fn>void <a href="#finish"><b>finish</b></a> ( QWidget * mainWin )</li> <li class=fn>void <a href="#repaint"><b>repaint</b></a> ()</li> </ul> <h2>Public Slots</h2> <ul> <li class=fn>void <a href="#message"><b>message</b></a> ( const QString & message, int alignment = AlignLeft, const QColor & color = black )</li> <li class=fn>void <a href="#clear"><b>clear</b></a> ()</li> </ul> <h2>Signals</h2> <ul> <li class=fn>void <a href="#messageChanged"><b>messageChanged</b></a> ( const QString & message )</li> </ul> <h2>Protected Members</h2> <ul> <li class=fn>virtual void <a href="#drawContents"><b>drawContents</b></a> ( QPainter * painter )</li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The QSplashScreen widget provides a splash screen that can be shown during application startup. <p> <p> 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. <p> The splash screen appears centered on the screen. It may be useful to add the <a href="qt.html#WidgetFlags-enum">WStyle_StaysOnTop</a> if you desire to keep above all the windows in the GUI. <p> Some X11 window managers do not support the "stays on top" flag. A solution is to set up a timer that periodically calls <a href="qwidget.html#raise">raise</a>() on the splash screen to simulate the "stays on top" effect. <p> 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. <p> <pre> int main( int argc, char **argv ) { <a href="qapplication.html">QApplication</a> app( argc, argv ); <a href="qpixmap.html">QPixmap</a> pixmap( "splash.png" ); QSplashScreen *splash = new QSplashScreen( pixmap ); splash-><a href="qwidget.html#show">show</a>(); <a href="qmainwindow.html">QMainWindow</a> *mainWin = new <a href="qmainwindow.html">QMainWindow</a>; ... app.<a href="qapplication.html#setMainWidget">setMainWidget</a>( mainWin ); mainWin-><a href="qwidget.html#show">show</a>(); splash-><a href="#finish">finish</a>( mainWin ); delete splash; return app.<a href="qapplication.html#exec">exec</a>(); } </pre> <p> 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 <a href="#message">message</a>() function. If you wish to do your own drawing you can get a pointer to the pixmap used in the splash screen with <a href="#pixmap">pixmap</a>(). Alternatively, you can subclass QSplashScreen and reimplement <a href="#drawContents">drawContents</a>(). <p> 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 <a href="qapplication.html#processEvents">QApplication::processEvents</a>() to receive the mouse clicks. <p> <pre> <a href="qpixmap.html">QPixmap</a> pixmap( "splash.png" ); QSplashScreen *splash = new QSplashScreen( pixmap ); splash-><a href="qwidget.html#show">show</a>(); ... // Loading some items splash-><a href="#message">message</a>( "Loaded modules" ); qApp-><a href="qapplication.html#processEvents">processEvents</a>(); ... // Establishing connections splash-><a href="#message">message</a>( "Established connections" ); qApp-><a href="qapplication.html#processEvents">processEvents</a>(); </pre> <p> <p>See also <a href="misc.html">Miscellaneous Classes</a>. <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="QSplashScreen"></a>QSplashScreen::QSplashScreen ( const <a href="qpixmap.html">QPixmap</a> & pixmap = QPixmap ( ), WFlags f = 0 ) </h3> Construct a splash screen that will display the <em>pixmap</em>. <p> There should be no need to set the widget flags, <em>f</em>, except perhaps <a href="qt.html#WidgetFlags-enum">WDestructiveClose</a> or <a href="qt.html#WidgetFlags-enum">WStyle_StaysOnTop</a>. <h3 class=fn><a name="~QSplashScreen"></a>QSplashScreen::~QSplashScreen ()<tt> [virtual]</tt> </h3> Destructor. <h3 class=fn>void <a name="clear"></a>QSplashScreen::clear ()<tt> [slot]</tt> </h3> Removes the message being displayed on the splash screen <p> <p>See also <a href="#message">message</a>(). <h3 class=fn>void <a name="drawContents"></a>QSplashScreen::drawContents ( <a href="qpainter.html">QPainter</a> * painter )<tt> [virtual protected]</tt> </h3> Draw the contents of the splash screen using painter <em>painter</em>. The default implementation draws the message passed by <a href="#message">message</a>(). Reimplement this function if you want to do your own drawing on the splash screen. <h3 class=fn>void <a name="finish"></a>QSplashScreen::finish ( <a href="qwidget.html">QWidget</a> * mainWin ) </h3> Makes the splash screen wait until the widget <em>mainWin</em> is displayed before calling <a href="qwidget.html#close">close</a>() on itself. <h3 class=fn>void <a name="message"></a>QSplashScreen::message ( const <a href="qstring.html">QString</a> & message, int alignment = AlignLeft, const <a href="qcolor.html">QColor</a> & color = black )<tt> [slot]</tt> </h3> Draws the <em>message</em> text onto the splash screen with color <em>color</em> and aligns the text according to the flags in <em>alignment</em>. <p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> and <a href="#clear">clear</a>(). <h3 class=fn>void <a name="messageChanged"></a>QSplashScreen::messageChanged ( const <a href="qstring.html">QString</a> & message )<tt> [signal]</tt> </h3> <p> This signal is emitted when the message on the splash screen changes. <em>message</em> is the new message and is a null-string when the message has been removed. <p> <p>See also <a href="#message">message</a>() and <a href="#clear">clear</a>(). <h3 class=fn><a href="qpixmap.html">QPixmap</a> * <a name="pixmap"></a>QSplashScreen::pixmap () const </h3> Returns the pixmap that is used in the splash screen. The image does not have any of the text drawn by <a href="#message">message</a>() calls. <h3 class=fn>void <a name="repaint"></a>QSplashScreen::repaint () </h3> This overrides <a href="qwidget.html#repaint">QWidget::repaint</a>(). It differs from the standard repaint function in that it also calls <a href="qapplication.html#flush">QApplication::flush</a>() to ensure the updates are displayed, even when there is no event loop present. <h3 class=fn>void <a name="setPixmap"></a>QSplashScreen::setPixmap ( const <a href="qpixmap.html">QPixmap</a> & pixmap ) </h3> Sets the pixmap that will be used as the splash screen's image to <em>pixmap</em>. <!-- eof --> <hr><p> This file is part of the <a href="index.html">Qt toolkit</a>. Copyright © 1995-2007 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2007 <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> <td align=right><div align=right>Qt 3.3.8</div> </table></div></address></body> </html>