summaryrefslogtreecommitdiffstats
path: root/doc/html/qsplashscreen.html
blob: 06d903456263b805f401947a089b012edfbd851e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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 &lt;<a href="qsplashscreen-h.html">qsplashscreen.h</a>&gt;</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&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap = QPixmap ( ), WFlags&nbsp;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&nbsp;QPixmap&nbsp;&amp;&nbsp;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&nbsp;*&nbsp;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&nbsp;QString&nbsp;&amp;&nbsp;message, int&nbsp;alignment = AlignLeft, const&nbsp;QColor&nbsp;&amp;&nbsp;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&nbsp;QString&nbsp;&amp;&nbsp;message )</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual void <a href="#drawContents"><b>drawContents</b></a> ( QPainter&nbsp;*&nbsp;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-&gt;<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-&gt;<a href="qwidget.html#show">show</a>();
       splash-&gt;<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-&gt;<a href="qwidget.html#show">show</a>();
   ... // Loading some items
   splash-&gt;<a href="#message">message</a>( "Loaded modules" );
   qApp-&gt;<a href="qapplication.html#processEvents">processEvents</a>();
   ... // Establishing connections
   splash-&gt;<a href="#message">message</a>( "Established connections" );
   qApp-&gt;<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&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap = QPixmap ( ), WFlags&nbsp;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>&nbsp;*&nbsp;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>&nbsp;*&nbsp;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&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>
</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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;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>&nbsp;* <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&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;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 &copy; 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 &copy; 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>