File: qsplashscreen.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (58 lines) | stat: -rw-r--r-- 10,716 bytes parent folder | download
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSplashScreen Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSplashScreen Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QSplashScreen widget provides a splash screen that can be shown during application startup. <a href="#details">More...</a></p>
<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsplashscreen.html#QSplashScreen">__init__</a></b> (<i>self</i>, QPixmap&#160;<i>pixmap</i>&#160;=&#160;QPixmap(), Qt.WindowFlags&#160;<i>f</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qsplashscreen.html#QSplashScreen-2">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>, QPixmap&#160;<i>pixmap</i>&#160;=&#160;QPixmap(), Qt.WindowFlags&#160;<i>f</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qsplashscreen.html#clearMessage">clearMessage</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsplashscreen.html#drawContents">drawContents</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>)</li><li><div class="fn" />bool <b><a href="qsplashscreen.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qsplashscreen.html#finish">finish</a></b> (<i>self</i>, QWidget&#160;<i>w</i>)</li><li><div class="fn" /><b><a href="qsplashscreen.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" />QPixmap <b><a href="qsplashscreen.html#pixmap">pixmap</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsplashscreen.html#repaint">repaint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsplashscreen.html#setPixmap">setPixmap</a></b> (<i>self</i>, QPixmap&#160;<i>pixmap</i>)</li><li><div class="fn" /><b><a href="qsplashscreen.html#showMessage">showMessage</a></b> (<i>self</i>, QString&#160;<i>message</i>, int&#160;<i>alignment</i>&#160;=&#160;Qt.AlignLeft, QColor&#160;<i>color</i>&#160;=&#160;Qt.black)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qsplashscreen.html#messageChanged">messageChanged</a></b> (const QString&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>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>
<p>The splash screen appears centered on the screen. It may be useful to add the <a href="qt.html#WindowType-enum">Qt.WStyle_StaysOnTop</a> if you desire to keep above all the windows in the GUI.</p>
<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>
<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)
    {
        QApplication app(argc, argv);
        QPixmap pixmap("splash.png");
        QSplashScreen *splash = new QSplashScreen(pixmap);
        splash-&gt;show();
        QMainWindow *mainWin = new QMainWindow;
        ...
        mainWin-&gt;show();
        splash-&gt;finish(mainWin);
        delete splash;
        return app.exec();
    }
</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="qsplashscreen.html#showMessage">showMessage</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="qsplashscreen.html#pixmap">pixmap</a>(). Alternatively, you can subclass QSplashScreen and reimplement <a href="qsplashscreen.html#drawContents">drawContents</a>().</p>
<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="qcoreapplication.html#processEvents">QApplication.processEvents</a>() to receive the mouse clicks.</p>
<pre>
    QSplashScreen *splash = new QSplashScreen("splash.png");
    splash-&gt;show();
    ... // Loading some items
    splash-&gt;showMessage("Loaded modules");
    qApp-&gt;processEvents();
    ... // Establishing connections
    splash-&gt;showMessage("Established connections");
    qApp-&gt;processEvents();
</pre>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSplashScreen" />QSplashScreen.__init__ (<i>self</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>&#160;=&#160;QPixmap(), <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>f</i>&#160;=&#160;0)</h3><p>Construct a splash screen that will display the <i>pixmap</i>.</p>
<p>There should be no need to set the widget flags, <i>f</i>, except perhaps <a href="qt.html#WindowType-enum">Qt.WindowStaysOnTopHint</a>.</p>
<h3 class="fn"><a name="QSplashScreen-2" />QSplashScreen.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>&#160;=&#160;QPixmap(), <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>f</i>&#160;=&#160;0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>This function allows you to specify a parent for your splashscreen. The typical use for this constructor is if you have a multiple screens and prefer to have the splash screen on a different screen than your primary one. In that case pass the proper desktop() as the <i>parent</i>.</p>
<h3 class="fn"><a name="clearMessage" />QSplashScreen.clearMessage (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clearMessage()</tt>.</p><p>Removes the message being displayed on the splash screen</p>
<p>See also <a href="qsplashscreen.html#showMessage">showMessage</a>().</p>
<h3 class="fn"><a name="drawContents" />QSplashScreen.drawContents (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>)</h3><p>Draw the contents of the splash screen using painter <i>painter</i>. The default implementation draws the message passed by <a href="qsplashscreen.html#showMessage">showMessage</a>(). Reimplement this function if you want to do your own drawing on the splash screen.</p>
<h3 class="fn"><a name="event" />bool QSplashScreen.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><h3 class="fn"><a name="finish" />QSplashScreen.finish (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>w</i>)</h3><p>Makes the splash screen wait until the widget <i>mainWin</i> is displayed before calling <a href="qwidget.html#close">close</a>() on itself.</p>
<h3 class="fn"><a name="mousePressEvent" />QSplashScreen.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><h3 class="fn"><a name="pixmap" /><a href="qpixmap.html">QPixmap</a> QSplashScreen.pixmap (<i>self</i>)</h3><p>Returns the pixmap that is used in the splash screen. The image does not have any of the text drawn by <a href="qsplashscreen.html#showMessage">showMessage</a>() calls.</p>
<p>See also <a href="qsplashscreen.html#setPixmap">setPixmap</a>().</p>
<h3 class="fn"><a name="repaint" />QSplashScreen.repaint (<i>self</i>)</h3><p>This overrides <a href="qwidget.html#repaint">QWidget.repaint</a>(). It differs from the standard repaint function in that it also calls <a href="qcoreapplication.html#flush">QApplication.flush</a>() to ensure the updates are displayed, even when there is no event loop present.</p>
<h3 class="fn"><a name="setPixmap" />QSplashScreen.setPixmap (<i>self</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>)</h3><p>Sets the pixmap that will be used as the splash screen's image to <i>pixmap</i>.</p>
<p>See also <a href="qsplashscreen.html#pixmap">pixmap</a>().</p>
<h3 class="fn"><a name="showMessage" />QSplashScreen.showMessage (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>message</i>, int&#160;<i>alignment</i>&#160;=&#160;Qt.AlignLeft, <a href="qcolor.html">QColor</a>&#160;<i>color</i>&#160;=&#160;Qt.black)</h3><p>This method is also a Qt slot with the C++ signature <tt>void showMessage(const QString&amp;,int = Qt.AlignLeft,const QColor&amp; = Qt.black)</tt>.</p><p>Draws the <i>message</i> text onto the splash screen with color <i>color</i> and aligns the text according to the flags in <i>alignment</i>.</p>
<p>See also <a href="qt.html#AlignmentFlag-enum">Qt.Alignment</a> and <a href="qsplashscreen.html#clearMessage">clearMessage</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="messageChanged" />void messageChanged (const QString&amp;)</h3><p>This signal is emitted when the message on the splash screen changes. <i>message</i> is the new message and is a null-string when the message has been removed.</p>
<p>See also <a href="qsplashscreen.html#showMessage">showMessage</a>() and <a href="qsplashscreen.html#clearMessage">clearMessage</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>