1QSplashScreen(3qt) QSplashScreen(3qt)
2
3
4
6 QSplashScreen - Splash screen that can be shown during application
7 startup
8
10 #include <qsplashscreen.h>
11
12 Inherits QWidget.
13
14 Public Members
15 QSplashScreen ( const QPixmap & pixmap = QPixmap ( ), WFlags f = 0 )
16 virtual ~QSplashScreen ()
17 void setPixmap ( const QPixmap & pixmap )
18 QPixmap * pixmap () const
19 void finish ( QWidget * mainWin )
20 void repaint ()
21
22 Public Slots
23 void message ( const QString & message, int alignment = AlignLeft,
24 const QColor & color = black )
25 void clear ()
26
27 Signals
28 void messageChanged ( const QString & message )
29
30 Protected Members
31 virtual void drawContents ( QPainter * painter )
32
34 The QSplashScreen widget provides a splash screen that can be shown
35 during application startup.
36
37 A splash screen is a widget that is usually displayed when an
38 application is being started. Splash screens are often used for
39 applications that have long start up times (e.g. database or networking
40 applications that take time to establish connections) to provide the
41 user with feedback that the application is loading.
42
43 The splash screen appears centered on the screen. It may be useful to
44 add the WStyle_StaysOnTop if you desire to keep above all the windows
45 in the GUI.
46
47 Some X11 window managers do not support the "stays on top" flag. A
48 solution is to set up a timer that periodically calls raise() on the
49 splash screen to simulate the "stays on top" effect.
50
51 The most common usage is to show a splash screen before the main widget
52 is displayed on the screen. This is illustrated in the following code
53 snippet.
54
55 int main( int argc, char **argv )
56 {
57 QApplication app( argc, argv );
58 QPixmap pixmap( "splash.png" );
59 QSplashScreen *splash = new QSplashScreen( pixmap );
60 splash->show();
61 QMainWindow *mainWin = new QMainWindow;
62 ...
63 app.setMainWidget( mainWin );
64 mainWin->show();
65 splash->finish( mainWin );
66 delete splash;
67 return app.exec();
68 }
69
70 It is sometimes useful to update the splash screen with messages, for
71 example, announcing connections established or modules loaded as the
72 application starts up. QSplashScreen supports this with the message()
73 function. If you wish to do your own drawing you can get a pointer to
74 the pixmap used in the splash screen with pixmap(). Alternatively, you
75 can subclass QSplashScreen and reimplement drawContents().
76
77 The user can hide the splash screen by clicking on it with the mouse.
78 Since the splash screen is typically displayed before the event loop
79 has started running, it is necessary to periodically call
80 QApplication::processEvents() to receive the mouse clicks.
81
82 QPixmap pixmap( "splash.png" );
83 QSplashScreen *splash = new QSplashScreen( pixmap );
84 splash->show();
85 ... // Loading some items
86 splash->message( "Loaded modules" );
87 qApp->processEvents();
88 ... // Establishing connections
89 splash->message( "Established connections" );
90 qApp->processEvents();
91
92 See also Miscellaneous Classes.
93
96 = 0 )
97 Construct a splash screen that will display the pixmap.
98
99 There should be no need to set the widget flags, f, except perhaps
100 WDestructiveClose or WStyle_StaysOnTop.
101
103 Destructor.
104
106 Removes the message being displayed on the splash screen
107
108 See also message().
109
111 Draw the contents of the splash screen using painter painter. The
112 default implementation draws the message passed by message().
113 Reimplement this function if you want to do your own drawing on the
114 splash screen.
115
117 Makes the splash screen wait until the widget mainWin is displayed
118 before calling close() on itself.
119
121 AlignLeft, const QColor & color = black ) [slot]
122 Draws the message text onto the splash screen with color color and
123 aligns the text according to the flags in alignment.
124
125 See also Qt::AlignmentFlags and clear().
126
128 This signal is emitted when the message on the splash screen changes.
129 message is the new message and is a null-string when the message has
130 been removed.
131
132 See also message() and clear().
133
135 Returns the pixmap that is used in the splash screen. The image does
136 not have any of the text drawn by message() calls.
137
139 This overrides QWidget::repaint(). It differs from the standard repaint
140 function in that it also calls QApplication::flush() to ensure the
141 updates are displayed, even when there is no event loop present.
142
144 Sets the pixmap that will be used as the splash screen's image to
145 pixmap.
146
147
149 http://doc.trolltech.com/qsplashscreen.html
150 http://www.trolltech.com/faq/tech.html
151
153 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
154 license file included in the distribution for a complete license
155 statement.
156
158 Generated automatically from the source code.
159
161 If you find a bug in Qt, please report it as described in
162 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
163 help you. Thank you.
164
165 The definitive Qt documentation is provided in HTML format; it is
166 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
167 web browser. This man page is provided as a convenience for those users
168 who prefer man pages, although this format is not officially supported
169 by Trolltech.
170
171 If you find errors in this manual page, please report them to qt-
172 bugs@trolltech.com. Please include the name of the manual page
173 (qsplashscreen.3qt) and the Qt version (3.3.8).
174
175
176
177Trolltech AS 2 February 2007 QSplashScreen(3qt)