source: trunk/doc/html/qsplashscreen.html@ 203

Last change on this file since 203 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 9.7 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qsplashscreen.cpp:53 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QSplashScreen Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<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>
33
34<p>The QSplashScreen widget provides a splash screen that can
35be shown during application startup.
36<a href="#details">More...</a>
37<p><tt>#include &lt;<a href="qsplashscreen-h.html">qsplashscreen.h</a>&gt;</tt>
38<p>Inherits <a href="qwidget.html">QWidget</a>.
39<p><a href="qsplashscreen-members.html">List of all member functions.</a>
40<h2>Public Members</h2>
41<ul>
42<li class=fn><a href="#QSplashScreen"><b>QSplashScreen</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap = QPixmap ( ), WFlags&nbsp;f = 0 )</li>
43<li class=fn>virtual <a href="#~QSplashScreen"><b>~QSplashScreen</b></a> ()</li>
44<li class=fn>void <a href="#setPixmap"><b>setPixmap</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap )</li>
45<li class=fn>QPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</li>
46<li class=fn>void <a href="#finish"><b>finish</b></a> ( QWidget&nbsp;*&nbsp;mainWin )</li>
47<li class=fn>void <a href="#repaint"><b>repaint</b></a> ()</li>
48</ul>
49<h2>Public Slots</h2>
50<ul>
51<li class=fn>void <a href="#message"><b>message</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;message, int&nbsp;alignment = AlignLeft, const&nbsp;QColor&nbsp;&amp;&nbsp;color = black )</li>
52<li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
53</ul>
54<h2>Signals</h2>
55<ul>
56<li class=fn>void <a href="#messageChanged"><b>messageChanged</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;message )</li>
57</ul>
58<h2>Protected Members</h2>
59<ul>
60<li class=fn>virtual void <a href="#drawContents"><b>drawContents</b></a> ( QPainter&nbsp;*&nbsp;painter )</li>
61</ul>
62<hr><a name="details"></a><h2>Detailed Description</h2>
63
64
65The QSplashScreen widget provides a splash screen that can
66be shown during application startup.
67<p>
68
69<p> A splash screen is a widget that is usually displayed when an
70application is being started. Splash screens are often used for
71applications that have long start up times (e.g. database or
72networking applications that take time to establish connections) to
73provide the user with feedback that the application is loading.
74<p> The splash screen appears centered on the screen. It may be useful to add
75the <a href="qt.html#WidgetFlags-enum">WStyle_StaysOnTop</a> if you desire to keep above all the windows in the
76GUI.
77<p> Some X11 window managers do not support the "stays on top" flag. A
78solution is to set up a timer that periodically calls <a href="qwidget.html#raise">raise</a>() on
79the splash screen to simulate the "stays on top" effect.
80<p> The most common usage is to show a splash screen before the main
81widget is displayed on the screen. This is illustrated in the
82following code snippet.
83<p> <pre>
84 int main( int argc, char **argv )
85 {
86 <a href="qapplication.html">QApplication</a> app( argc, argv );
87 <a href="qpixmap.html">QPixmap</a> pixmap( "splash.png" );
88 QSplashScreen *splash = new QSplashScreen( pixmap );
89 splash-&gt;<a href="qwidget.html#show">show</a>();
90 <a href="qmainwindow.html">QMainWindow</a> *mainWin = new <a href="qmainwindow.html">QMainWindow</a>;
91 ...
92 app.<a href="qapplication.html#setMainWidget">setMainWidget</a>( mainWin );
93 mainWin-&gt;<a href="qwidget.html#show">show</a>();
94 splash-&gt;<a href="#finish">finish</a>( mainWin );
95 delete splash;
96 return app.<a href="qapplication.html#exec">exec</a>();
97 }
98 </pre>
99
100<p> It is sometimes useful to update the splash screen with messages,
101for example, announcing connections established or modules loaded
102as the application starts up. QSplashScreen supports this with the
103<a href="#message">message</a>() function. If you wish to do your own drawing you can
104get a pointer to the pixmap used in the splash screen with <a href="#pixmap">pixmap</a>().
105Alternatively, you can subclass QSplashScreen and reimplement
106<a href="#drawContents">drawContents</a>().
107<p> The user can hide the splash screen by clicking on it with the
108mouse. Since the splash screen is typically displayed before the
109event loop has started running, it is necessary to periodically
110call <a href="qapplication.html#processEvents">QApplication::processEvents</a>() to receive the mouse clicks.
111<p> <pre>
112 <a href="qpixmap.html">QPixmap</a> pixmap( "splash.png" );
113 QSplashScreen *splash = new QSplashScreen( pixmap );
114 splash-&gt;<a href="qwidget.html#show">show</a>();
115 ... // Loading some items
116 splash-&gt;<a href="#message">message</a>( "Loaded modules" );
117 qApp-&gt;<a href="qapplication.html#processEvents">processEvents</a>();
118 ... // Establishing connections
119 splash-&gt;<a href="#message">message</a>( "Established connections" );
120 qApp-&gt;<a href="qapplication.html#processEvents">processEvents</a>();
121 </pre>
122
123<p> <p>See also <a href="misc.html">Miscellaneous Classes</a>.
124
125<hr><h2>Member Function Documentation</h2>
126<h3 class=fn><a name="QSplashScreen"></a>QSplashScreen::QSplashScreen ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap = QPixmap ( ), WFlags&nbsp;f = 0 )
127</h3>
128Construct a splash screen that will display the <em>pixmap</em>.
129<p> There should be no need to set the widget flags, <em>f</em>, except
130perhaps <a href="qt.html#WidgetFlags-enum">WDestructiveClose</a> or <a href="qt.html#WidgetFlags-enum">WStyle_StaysOnTop</a>.
131
132<h3 class=fn><a name="~QSplashScreen"></a>QSplashScreen::~QSplashScreen ()<tt> [virtual]</tt>
133</h3>
134Destructor.
135
136<h3 class=fn>void <a name="clear"></a>QSplashScreen::clear ()<tt> [slot]</tt>
137</h3>
138Removes the message being displayed on the splash screen
139<p> <p>See also <a href="#message">message</a>().
140
141<h3 class=fn>void <a name="drawContents"></a>QSplashScreen::drawContents ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;painter )<tt> [virtual protected]</tt>
142</h3>
143Draw the contents of the splash screen using painter <em>painter</em>.
144The default implementation draws the message passed by <a href="#message">message</a>().
145Reimplement this function if you want to do your own drawing on
146the splash screen.
147
148<h3 class=fn>void <a name="finish"></a>QSplashScreen::finish ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;mainWin )
149</h3>
150Makes the splash screen wait until the widget <em>mainWin</em> is displayed
151before calling <a href="qwidget.html#close">close</a>() on itself.
152
153<h3 class=fn>void <a name="message"></a>QSplashScreen::message ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;message, int&nbsp;alignment = AlignLeft, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;color = black )<tt> [slot]</tt>
154</h3>
155Draws 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>.
156<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> and <a href="#clear">clear</a>().
157
158<h3 class=fn>void <a name="messageChanged"></a>QSplashScreen::messageChanged ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;message )<tt> [signal]</tt>
159</h3>
160
161<p> This signal is emitted when the message on the splash screen
162changes. <em>message</em> is the new message and is a null-string
163when the message has been removed.
164<p> <p>See also <a href="#message">message</a>() and <a href="#clear">clear</a>().
165
166<h3 class=fn><a href="qpixmap.html">QPixmap</a>&nbsp;* <a name="pixmap"></a>QSplashScreen::pixmap () const
167</h3>
168Returns the pixmap that is used in the splash screen. The image
169does not have any of the text drawn by <a href="#message">message</a>() calls.
170
171<h3 class=fn>void <a name="repaint"></a>QSplashScreen::repaint ()
172</h3>
173This overrides <a href="qwidget.html#repaint">QWidget::repaint</a>(). It differs from the standard
174repaint function in that it also calls <a href="qapplication.html#flush">QApplication::flush</a>() to
175ensure the updates are displayed, even when there is no event loop
176present.
177
178<h3 class=fn>void <a name="setPixmap"></a>QSplashScreen::setPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap )
179</h3>
180Sets the pixmap that will be used as the splash screen's image to
181<em>pixmap</em>.
182
183<!-- eof -->
184<hr><p>
185This file is part of the <a href="index.html">Qt toolkit</a>.
186Copyright &copy; 1995-2007
187<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
188<table width=100% cellspacing=0 border=0><tr>
189<td>Copyright &copy; 2007
190<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
191<td align=right><div align=right>Qt 3.3.8</div>
192</table></div></address></body>
193</html>
Note: See TracBrowser for help on using the repository browser.