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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsplashscreen.cpp -->
<title>Qt 4.8: QSplashScreen Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QSplashScreen</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QSplashScreen Class Reference</h1>
<!-- $$$QSplashScreen-brief -->
<p>The QSplashScreen widget provides a splash screen that can be shown during application startup. <a href="#details">More...</a></p>
<!-- @@@QSplashScreen -->
<pre class="cpp"> <span class="preprocessor">#include <QSplashScreen></span></pre><p><b>Inherits: </b><a href="qwidget.html">QWidget</a>.</p>
<ul>
<li><a href="qsplashscreen-members.html">List of all members, including inherited members</a></li>
<li><a href="qsplashscreen-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#QSplashScreen">QSplashScreen</a></b> ( const QPixmap & <i>pixmap</i> = QPixmap(), Qt::WindowFlags <i>f</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#QSplashScreen-2">QSplashScreen</a></b> ( QWidget * <i>parent</i>, const QPixmap & <i>pixmap</i> = QPixmap(), Qt::WindowFlags <i>f</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#dtor.QSplashScreen">~QSplashScreen</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#finish">finish</a></b> ( QWidget * <i>mainWin</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPixmap </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#pixmap">pixmap</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#repaint">repaint</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#setPixmap">setPixmap</a></b> ( const QPixmap & <i>pixmap</i> )</td></tr>
</table>
<ul>
<li class="fn">221 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li class="fn">13 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#clearMessage">clearMessage</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#showMessage">showMessage</a></b> ( const QString & <i>message</i>, int <i>alignment</i> = Qt::AlignLeft, const QColor & <i>color</i> = Qt::black )</td></tr>
</table>
<ul>
<li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#messageChanged">messageChanged</a></b> ( const QString & <i>message</i> )</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#drawContents">drawContents</a></b> ( QPainter * <i>painter</i> )</td></tr>
</table>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#event">event</a></b> ( QEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsplashscreen.html#mousePressEvent">mousePressEvent</a></b> ( QMouseEvent * )</td></tr>
</table>
<ul>
<li class="fn">37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">58 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<!-- $$$QSplashScreen-description -->
<div class="descr">
<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 in the center of the screen. It may be useful to add the <a href="qt.html#WindowType-enum">Qt::WindowStaysOnTopHint</a> to the splash widget's window flags if you want to keep it above all the other windows on the desktop.</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 in which a splash screen is displayed and some initialization tasks are performed before the application's main window is shown:</p>
<pre class="cpp"> <span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
{
<span class="type"><a href="qapplication.html">QApplication</a></span> app(argc<span class="operator">,</span> argv);
<span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap(<span class="string">":/splash.png"</span>);
<span class="type">QSplashScreen</span> splash(pixmap);
splash<span class="operator">.</span>show();
app<span class="operator">.</span>processEvents();
...
<span class="type"><a href="qmainwindow.html">QMainWindow</a></span> window;
window<span class="operator">.</span>show();
splash<span class="operator">.</span>finish(<span class="operator">&</span>window);
<span class="keyword">return</span> app<span class="operator">.</span>exec();
}</pre>
<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>
<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:</p>
<pre class="cpp"> <span class="type"><a href="qpixmap.html">QPixmap</a></span> <a href="qsplashscreen.html#pixmap">pixmap</a>(<span class="string">":/splash.png"</span>);
<span class="type">QSplashScreen</span> <span class="operator">*</span>splash <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QSplashScreen</span>(pixmap);
splash<span class="operator">-</span><span class="operator">></span><a href="qwidget.html#show">show</a>();
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> <span class="comment">// Loading some items</span>
splash<span class="operator">-</span><span class="operator">></span><a href="qsplashscreen.html#showMessage">showMessage</a>(<span class="string">"Loaded modules"</span>);
qApp<span class="operator">-</span><span class="operator">></span>processEvents();
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> <span class="comment">// Establishing connections</span>
splash<span class="operator">-</span><span class="operator">></span><a href="qsplashscreen.html#showMessage">showMessage</a>(<span class="string">"Established connections"</span>);
qApp<span class="operator">-</span><span class="operator">></span>processEvents();</pre>
<p>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>
</div>
<!-- @@@QSplashScreen -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QSplashScreen[overload1]$$$QSplashScreenconstQPixmap&Qt::WindowFlags -->
<h3 class="fn"><a name="QSplashScreen"></a>QSplashScreen::<span class="name">QSplashScreen</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> & <i>pixmap</i> = QPixmap(), <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>f</i> = 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>
<!-- @@@QSplashScreen -->
<!-- $$$QSplashScreen$$$QSplashScreenQWidget*constQPixmap&Qt::WindowFlags -->
<h3 class="fn"><a name="QSplashScreen-2"></a>QSplashScreen::<span class="name">QSplashScreen</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> & <i>pixmap</i> = QPixmap(), <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>f</i> = 0 )</h3>
<p>This is an overloaded function.</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>
<!-- @@@QSplashScreen -->
<!-- $$$~QSplashScreen[overload1]$$$~QSplashScreen -->
<h3 class="fn"><a name="dtor.QSplashScreen"></a>QSplashScreen::<span class="name">~QSplashScreen</span> ()<tt> [virtual]</tt></h3>
<p>Destructor.</p>
<!-- @@@~QSplashScreen -->
<!-- $$$clearMessage[overload1]$$$clearMessage -->
<h3 class="fn"><a name="clearMessage"></a><span class="type">void</span> QSplashScreen::<span class="name">clearMessage</span> ()<tt> [slot]</tt></h3>
<p>Removes the message being displayed on the splash screen</p>
<p><b>See also </b><a href="qsplashscreen.html#showMessage">showMessage</a>().</p>
<!-- @@@clearMessage -->
<!-- $$$drawContents[overload1]$$$drawContentsQPainter* -->
<h3 class="fn"><a name="drawContents"></a><span class="type">void</span> QSplashScreen::<span class="name">drawContents</span> ( <span class="type"><a href="qpainter.html">QPainter</a></span> * <i>painter</i> )<tt> [virtual protected]</tt></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>
<!-- @@@drawContents -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QSplashScreen::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$finish[overload1]$$$finishQWidget* -->
<h3 class="fn"><a name="finish"></a><span class="type">void</span> QSplashScreen::<span class="name">finish</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>mainWin</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>
<!-- @@@finish -->
<!-- $$$messageChanged[overload1]$$$messageChangedconstQString& -->
<h3 class="fn"><a name="messageChanged"></a><span class="type">void</span> QSplashScreen::<span class="name">messageChanged</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>message</i> )<tt> [signal]</tt></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><b>See also </b><a href="qsplashscreen.html#showMessage">showMessage</a>() and <a href="qsplashscreen.html#clearMessage">clearMessage</a>().</p>
<!-- @@@messageChanged -->
<!-- $$$mousePressEvent[overload1]$$$mousePressEventQMouseEvent* -->
<h3 class="fn"><a name="mousePressEvent"></a><span class="type">void</span> QSplashScreen::<span class="name">mousePressEvent</span> ( <span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> * )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget::mousePressEvent</a>().</p>
<!-- @@@mousePressEvent -->
<!-- $$$pixmap[overload1]$$$pixmap -->
<h3 class="fn"><a name="pixmap"></a>const <span class="type"><a href="qpixmap.html">QPixmap</a></span> QSplashScreen::<span class="name">pixmap</span> () const</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><b>See also </b><a href="qsplashscreen.html#setPixmap">setPixmap</a>().</p>
<!-- @@@pixmap -->
<!-- $$$repaint[overload1]$$$repaint -->
<h3 class="fn"><a name="repaint"></a><span class="type">void</span> QSplashScreen::<span class="name">repaint</span> ()</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>
<!-- @@@repaint -->
<!-- $$$setPixmap[overload1]$$$setPixmapconstQPixmap& -->
<h3 class="fn"><a name="setPixmap"></a><span class="type">void</span> QSplashScreen::<span class="name">setPixmap</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> & <i>pixmap</i> )</h3>
<p>Sets the pixmap that will be used as the splash screen's image to <i>pixmap</i>.</p>
<p><b>See also </b><a href="qsplashscreen.html#pixmap">pixmap</a>().</p>
<!-- @@@setPixmap -->
<!-- $$$showMessage[overload1]$$$showMessageconstQString&intconstQColor& -->
<h3 class="fn"><a name="showMessage"></a><span class="type">void</span> QSplashScreen::<span class="name">showMessage</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>message</i>, <span class="type">int</span> <i>alignment</i> = Qt::AlignLeft, const <span class="type"><a href="qcolor.html">QColor</a></span> & <i>color</i> = Qt::black )<tt> [slot]</tt></h3>
<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>To make sure the splash screen is repainted immediately, you can call <a href="qcoreapplication.html">QCoreApplication</a>'s <a href="qcoreapplication.html#processEvents">processEvents()</a> after the call to showMessage(). You usually want this to make sure that the message is kept up to date with what your application is doing (e.g., loading files).</p>
<p><b>See also </b><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> and <a href="qsplashscreen.html#clearMessage">clearMessage</a>().</p>
<!-- @@@showMessage -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|