1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/gui/widgets/qstatusbar.cpp -->
7
<title>Qt 4.0: QStatusBar Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QStatusBar Class Reference</h1>
21
<p>The QStatusBar class provides a horizontal bar suitable for presenting status information. <a href="#details">More...</a></p>
22
<pre>#include <QStatusBar></pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
23
<p>Inherits <a href="qwidget.html">QWidget</a>.</p>
25
<li><a href="qstatusbar-members.html">List of all members, including inherited members</a></li>
26
<li><a href="qstatusbar-qt3.html">Qt 3 support members</a></li>
28
<a name="properties"></a>
31
<li><div class="fn"/><b><a href="qstatusbar.html#sizeGripEnabled-prop">sizeGripEnabled</a></b> : bool</li>
34
<li><div class="fn"/>52 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
35
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
37
<a name="public-functions"></a>
38
<h3>Public Functions</h3>
40
<li><div class="fn"/><b><a href="qstatusbar.html#QStatusBar">QStatusBar</a></b> ( QWidget * <i>parent</i> = 0 )</li>
41
<li><div class="fn"/>virtual <b><a href="qstatusbar.html#dtor.QStatusBar">~QStatusBar</a></b> ()</li>
42
<li><div class="fn"/>void <b><a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a></b> ( QWidget * <i>widget</i>, int <i>stretch</i> = 0 )</li>
43
<li><div class="fn"/>void <b><a href="qstatusbar.html#addWidget">addWidget</a></b> ( QWidget * <i>widget</i>, int <i>stretch</i> = 0 )</li>
44
<li><div class="fn"/>QString <b><a href="qstatusbar.html#currentMessage">currentMessage</a></b> () const</li>
45
<li><div class="fn"/>bool <b><a href="qstatusbar.html#sizeGripEnabled-prop">isSizeGripEnabled</a></b> () const</li>
46
<li><div class="fn"/>void <b><a href="qstatusbar.html#removeWidget">removeWidget</a></b> ( QWidget * <i>widget</i> )</li>
47
<li><div class="fn"/>void <b><a href="qstatusbar.html#sizeGripEnabled-prop">setSizeGripEnabled</a></b> ( bool )</li>
50
<li><div class="fn"/>183 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
51
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
52
<li><div class="fn"/>10 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
54
<a name="public-slots"></a>
57
<li><div class="fn"/>void <b><a href="qstatusbar.html#clearMessage">clearMessage</a></b> ()</li>
58
<li><div class="fn"/>void <b><a href="qstatusbar.html#showMessage">showMessage</a></b> ( const QString & <i>message</i>, int <i>timeout</i> = 0 )</li>
61
<li><div class="fn"/>17 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
62
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
64
<a name="signals"></a>
67
<li><div class="fn"/>void <b><a href="qstatusbar.html#messageChanged">messageChanged</a></b> ( const QString & <i>message</i> )</li>
70
<li><div class="fn"/>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
71
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
73
<a name="protected-functions"></a>
74
<h3>Protected Functions</h3>
76
<li><div class="fn"/>void <b><a href="qstatusbar.html#hideOrShow">hideOrShow</a></b> ()</li>
77
<li><div class="fn"/>virtual void <b><a href="qstatusbar.html#paintEvent">paintEvent</a></b> ( QPaintEvent * <i>event</i> )</li>
78
<li><div class="fn"/>void <b><a href="qstatusbar.html#reformat">reformat</a></b> ()</li>
81
<li><div class="fn"/>39 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
82
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
84
<h3>Additional Inherited Members</h3>
86
<li><div class="fn"/>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
87
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
89
<a name="details"></a>
91
<h2>Detailed Description</h2>
92
<p>The QStatusBar class provides a horizontal bar suitable for presenting status information.</p>
93
<p>Each status indicator falls into one of three categories:</p>
95
<li><i>Temporary</i> - briefly occupies most of the status bar. Used to explain tool tip texts or menu entries, for example.</li>
96
<li><i>Normal</i> - occupies part of the status bar and may be hidden by temporary messages. Used to display the page and line number in a word processor, for example.</li>
97
<li><i>Permanent</i> - is never hidden. Used for important mode indications, for example, some applications put a Caps Lock indicator in the status bar.</li>
99
<p>QStatusBar lets you display all three types of indicators.</p>
100
<p>To display a <i>temporary</i> message, call <a href="qstatusbar.html#showMessage">showMessage</a>() (perhaps by connecting a suitable signal to it). To remove a temporary message, call <a href="qstatusbar.html#clearMessage">clearMessage</a>(), or set a time limit when calling <a href="qstatusbar.html#showMessage">showMessage</a>():</p>
101
<pre> connect(loader, SIGNAL(progressMessage(QString)),
102
statusBar(), SLOT(showMessage(QString)));
104
statusBar()->showMessage("Loading..."); // Initial message
105
loader.loadStuff(); // Emits progress messages
106
statusBar()->showMessage("Done.", 2000); // Final message for 2 seconds</pre>
107
<p><i>Normal</i> and <i>Permanent</i> messages are displayed by creating a small widget and then adding it to the status bar with <a href="qstatusbar.html#addWidget">addWidget</a>() or <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>(). Widgets like <a href="qlabel.html">QLabel</a>, <a href="qprogressbar.html">QProgressBar</a> or even <a href="qtoolbutton.html">QToolButton</a> are useful for adding to status bars. <a href="qstatusbar.html#removeWidget">removeWidget</a>() is used to remove widgets.</p>
108
<pre> statusBar()->addWidget(new MyReadWriteIndication);</pre>
109
<p>By default QStatusBar provides a <a href="qsizegrip.html">QSizeGrip</a> in the lower-right corner. You can disable it with setSizeGripEnabled(false);</p>
110
<p><img src="images/qstatusbar-m.png" alt="Screenshot in Motif style" /> <img src="images/qstatusbar-w.png" alt="Screenshot in Windows style" /></p>
111
<p>See also <a href="qtoolbar.html">QToolBar</a>, <a href="qmainwindow.html">QMainWindow</a>, <a href="qlabel.html">QLabel</a>, and <a href="guibooks.html#fowler">GUI Design Handbook: Status Bar</a>.</p>
113
<h2>Property Documentation</h2>
114
<h3 class="fn"><a name="sizeGripEnabled-prop"></a>sizeGripEnabled : bool</h3>
115
<p>This property holds whether the QSizeGrip in the bottom-right of the status bar is enabled.</p>
116
<p>Enables or disables the <a href="qsizegrip.html">QSizeGrip</a> in the bottom-right of the status bar. By default, the size grip is enabled.</p>
117
<p>Access functions:</p>
119
<li><div class="fn"/><b>bool isSizeGripEnabled () const</b></li>
120
<li><div class="fn"/><b>void setSizeGripEnabled ( bool )</b></li>
123
<h2>Member Function Documentation</h2>
124
<h3 class="fn"><a name="QStatusBar"></a>QStatusBar::QStatusBar ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
125
<p>Constructs a status bar with a size grip with the given <i>parent</i>.</p>
126
<p>See also <a href="qstatusbar.html#sizeGripEnabled-prop">setSizeGripEnabled</a>().</p>
127
<h3 class="fn"><a name="dtor.QStatusBar"></a>QStatusBar::~QStatusBar () <tt> [virtual]</tt></h3>
128
<p>Destroys the status bar and frees any allocated resources and child widgets.</p>
129
<h3 class="fn"><a name="addPermanentWidget"></a>void QStatusBar::addPermanentWidget ( <a href="qwidget.html">QWidget</a> * <i>widget</i>, int <i>stretch</i> = 0 )</h3>
130
<p>Adds <i>widget</i> permanently to this status bar. <i>widget</i> is reparented if it isn't already a child of the <a href="qstatusbar.html">QStatusBar</a>.</p>
131
<p>Permanently means that the widget may not be obscured by temporary messages. It is is located at the far right of the status bar.</p>
132
<p><i>stretch</i> is used to compute a suitable size for <i>widget</i> as the status bar grows and shrinks. The default of 0 uses a minimum of space.</p>
133
<p>This function may cause some flicker.</p>
134
<p>See also <a href="qstatusbar.html#removeWidget">removeWidget</a>() and <a href="qstatusbar.html#addWidget">addWidget</a>().</p>
135
<h3 class="fn"><a name="addWidget"></a>void QStatusBar::addWidget ( <a href="qwidget.html">QWidget</a> * <i>widget</i>, int <i>stretch</i> = 0 )</h3>
136
<p>Adds <i>widget</i> to this status bar. <i>widget</i> is reparented if it isn't already a child of the <a href="qstatusbar.html">QStatusBar</a>.</p>
137
<p>The widget is located just to the left of the first permanent widget (see addWidgetPermantly()) and may be obscured by temporary messages.</p>
138
<p><i>stretch</i> is used to compute a suitable size for <i>widget</i> as the status bar grows and shrinks. The default of 0 uses a minimum of space.</p>
139
<p>This function may cause some flicker.</p>
140
<p>See also <a href="qstatusbar.html#removeWidget">removeWidget</a>() and <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>().</p>
141
<h3 class="fn"><a name="clearMessage"></a>void QStatusBar::clearMessage () <tt> [slot]</tt></h3>
142
<p>Removes any temporary message being shown.</p>
143
<p>See also <a href="qstatusbar.html#showMessage">showMessage</a>().</p>
144
<h3 class="fn"><a name="currentMessage"></a><a href="qstring.html">QString</a> QStatusBar::currentMessage () const</h3>
145
<p>Returns the temporary message currently shown, or an empty string if there is no such message.</p>
146
<h3 class="fn"><a name="hideOrShow"></a>void QStatusBar::hideOrShow () <tt> [protected]</tt></h3>
147
<p>Ensures that the right widgets are visible. Used by <a href="qstatusbar.html#showMessage">showMessage</a>() and <a href="qstatusbar.html#clearMessage">clearMessage</a>().</p>
148
<h3 class="fn"><a name="messageChanged"></a>void QStatusBar::messageChanged ( const <a href="qstring.html">QString</a> & <i>message</i> ) <tt> [signal]</tt></h3>
149
<p>This signal is emitted when the temporary status messages changes. <i>message</i> is the new temporary message, and is a null-string when the message has been removed.</p>
150
<p>See also <a href="qstatusbar.html#showMessage">showMessage</a>() and <a href="qstatusbar.html#clearMessage">clearMessage</a>().</p>
151
<h3 class="fn"><a name="paintEvent"></a>void QStatusBar::paintEvent ( <a href="qpaintevent.html">QPaintEvent</a> * <i>event</i> ) <tt> [virtual protected]</tt></h3>
152
<p>Shows the temporary message, if appropriate, in response to the paint <i>event</i>.</p>
153
<p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget</a>.</p>
154
<h3 class="fn"><a name="reformat"></a>void QStatusBar::reformat () <tt> [protected]</tt></h3>
155
<p>Changes the status bar's appearance to account for item changes. Special subclasses may need this, but geometry management will usually take care of any necessary rearrangements.</p>
156
<h3 class="fn"><a name="removeWidget"></a>void QStatusBar::removeWidget ( <a href="qwidget.html">QWidget</a> * <i>widget</i> )</h3>
157
<p>Removes <i>widget</i> from the status bar.</p>
158
<p>This function may cause some flicker.</p>
159
<p>Note that <i>widget</i> is not deleted.</p>
160
<p>See also <a href="qstatusbar.html#addWidget">addWidget</a>().</p>
161
<h3 class="fn"><a name="showMessage"></a>void QStatusBar::showMessage ( const <a href="qstring.html">QString</a> & <i>message</i>, int <i>timeout</i> = 0 ) <tt> [slot]</tt></h3>
162
<p>Hides the normal status indications and displays <i>message</i> for <i>timeout</i> milli-seconds (if non-zero), or until <a href="qstatusbar.html#clearMessage">clearMessage</a>() or another showMessage() is called, whichever occurs first.</p>
163
<p /><address><hr /><div align="center">
164
<table width="100%" cellspacing="0" border="0"><tr class="address">
165
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
166
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
167
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
168
</tr></table></div></address></body>