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
|
<?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>QStatusBar 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">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QStatusBar Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QStatusBar class provides a horizontal bar suitable for presenting status information. <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="qstatusbar.html#QStatusBar">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a></b> (<i>self</i>, QWidget <i>widget</i>, int <i>stretch</i> = 0)</li><li><div class="fn" /><b><a href="qstatusbar.html#addWidget">addWidget</a></b> (<i>self</i>, QWidget <i>widget</i>, int <i>stretch</i> = 0)</li><li><div class="fn" /><b><a href="qstatusbar.html#clearMessage">clearMessage</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qstatusbar.html#currentMessage">currentMessage</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qstatusbar.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qstatusbar.html#hideOrShow">hideOrShow</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qstatusbar.html#isSizeGripEnabled">isSizeGripEnabled</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstatusbar.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qstatusbar.html#reformat">reformat</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstatusbar.html#removeWidget">removeWidget</a></b> (<i>self</i>, QWidget <i>widget</i>)</li><li><div class="fn" /><b><a href="qstatusbar.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qstatusbar.html#setSizeGripEnabled">setSizeGripEnabled</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qstatusbar.html#showMessage">showMessage</a></b> (<i>self</i>, QString <i>text</i>, int <i>timeout</i> = 0)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qstatusbar.html#messageChanged">messageChanged</a></b> (const QString&)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QStatusBar class provides a horizontal bar suitable for presenting status information.</p>
<p>Each status indicator falls into one of three categories:</p>
<ul>
<li><i>Temporary</i> - briefly occupies most of the status bar. Used to explain tool tip texts or menu entries, for example.</li>
<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>
<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>
</ul>
<p>QStatusBar lets you display all three types of indicators.</p>
<p>Typically, a request for the status bar functionality occurs in relation to a <a href="qmainwindow.html">QMainWindow</a> object. <a href="qmainwindow.html">QMainWindow</a> provides a main application window, with a menu bar, tool bars, dock widgets <i>and</i> a status bar around a large central widget. The status bar can be retrieved using the <a href="qmainwindow.html#statusBar">QMainWindow.statusBar</a>() function, and replaced using the <a href="qmainwindow.html#setStatusBar">QMainWindow.setStatusBar</a>() function.</p>
<p>Use the <a href="qstatusbar.html#showMessage">showMessage</a>() slot to display a <i>temporary</i> message:</p>
<pre>
void MainWindow.createStatusBar()
{
statusBar()->showMessage(tr("Ready"));
}
</pre>
<p>To remove a temporary message, use the <a href="qstatusbar.html#clearMessage">clearMessage</a>() slot, or set a time limit when calling <a href="qstatusbar.html#showMessage">showMessage</a>(). For example:</p>
<pre>
void MainWindow.print()
{
QTextDocument *document = textEdit->document();
QPrinter printer;
QPrintDialog *dlg = new QPrintDialog(&printer, this);
if (dlg->exec() != QDialog.Accepted)
return;
document->print(&printer);
statusBar()->showMessage(tr("Ready"), 2000);
}
</pre>
<p>Use the <a href="qstatusbar.html#currentMessage">currentMessage</a>() function to retrieve the temporary message currently shown. The QStatusBar class also provide the <a href="qstatusbar.html#messageChanged">messageChanged</a>() signal which is emitted whenever the temporary status message changes.</p>
<p><i>Normal</i> and <i>Permanent</i> messages are displayed by creating a small widget (<a href="qlabel.html">QLabel</a>, <a href="qprogressbar.html">QProgressBar</a> or even <a href="qtoolbutton.html">QToolButton</a>) and then adding it to the status bar using the <a href="qstatusbar.html#addWidget">addWidget</a>() or the <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>() function. Use the <a href="qstatusbar.html#removeWidget">removeWidget</a>() function to remove such messages from the status bar.</p>
<pre>
statusBar()->addWidget(new MyReadWriteIndication);
</pre>
<p>By default QStatusBar provides a <a href="qsizegrip.html">QSizeGrip</a> in the lower-right corner. You can disable it using the <a href="qstatusbar.html#sizeGripEnabled-prop">setSizeGripEnabled</a>() function. Use the <a href="qstatusbar.html#sizeGripEnabled-prop">isSizeGripEnabled</a>() function to determine the current status of the size grip.</p>
<p align="center"><img alt="A status bar shown in the Plastique widget style." src="images/plastique-statusbar.png" /></p>
<p>See also <a href="qmainwindow.html">QMainWindow</a>, <a href="qstatustipevent.html">QStatusTipEvent</a>, and <a href="guibooks.html#fowler">GUI Design Handbook: Status Bar</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QStatusBar" />QStatusBar.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a status bar with a size grip and the given <i>parent</i>.</p>
<p>See also <a href="qstatusbar.html#sizeGripEnabled-prop">setSizeGripEnabled</a>().</p>
<h3 class="fn"><a name="addPermanentWidget" />QStatusBar.addPermanentWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>, int <i>stretch</i> = 0)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>widget</i> permanently to this status bar, reparenting the widget if it isn't already a child of this <a href="qstatusbar.html">QStatusBar</a> object. The <i>stretch</i> parameter is used to compute a suitable size for the given <i>widget</i> as the status bar grows and shrinks. The default stretch factor is 0, i.e giving the widget a minimum of space.</p>
<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>
<p>Note that this function may cause some flicker.</p>
<p>See also <a href="qstatusbar.html#removeWidget">removeWidget</a>() and <a href="qstatusbar.html#addWidget">addWidget</a>().</p>
<h3 class="fn"><a name="addWidget" />QStatusBar.addWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>, int <i>stretch</i> = 0)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>widget</i> to this status bar, reparenting the widget if it isn't already a child of this <a href="qstatusbar.html">QStatusBar</a> object. The <i>stretch</i> parameter is used to compute a suitable size for the given <i>widget</i> as the status bar grows and shrinks. The default stretch factor is 0, i.e giving the widget a minimum of space.</p>
<p>The widget is located to the far left of the first permanent widget (see <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>()) and may be obscured by temporary messages.</p>
<p>Note that this function may cause some flicker.</p>
<p>See also <a href="qstatusbar.html#removeWidget">removeWidget</a>() and <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>().</p>
<h3 class="fn"><a name="clearMessage" />QStatusBar.clearMessage (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clearMessage()</tt>.</p><p>Removes any temporary message being shown.</p>
<p>See also <a href="qstatusbar.html#currentMessage">currentMessage</a>(), <a href="qstatusbar.html#showMessage">showMessage</a>(), and <a href="qstatusbar.html#removeWidget">removeWidget</a>().</p>
<h3 class="fn"><a name="currentMessage" /><a href="qstring.html">QString</a> QStatusBar.currentMessage (<i>self</i>)</h3><p>Returns the temporary message currently shown, or an empty string if there is no such message.</p>
<p>See also <a href="qstatusbar.html#showMessage">showMessage</a>().</p>
<h3 class="fn"><a name="event" />bool QStatusBar.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><h3 class="fn"><a name="hideOrShow" />QStatusBar.hideOrShow (<i>self</i>)</h3><p>Ensures that the right widgets are visible.</p>
<p>Used by the <a href="qstatusbar.html#showMessage">showMessage</a>() and <a href="qstatusbar.html#clearMessage">clearMessage</a>() functions.</p>
<h3 class="fn"><a name="isSizeGripEnabled" />bool QStatusBar.isSizeGripEnabled (<i>self</i>)</h3><h3 class="fn"><a name="paintEvent" />QStatusBar.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><h3 class="fn"><a name="reformat" />QStatusBar.reformat (<i>self</i>)</h3><p>Changes the status bar's appearance to account for item changes.</p>
<p>Special subclasses may need this function, but geometry management will usually take care of any necessary rearrangements.</p>
<h3 class="fn"><a name="removeWidget" />QStatusBar.removeWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>The <i>widget</i> argument</p><p>Removes the specifed <i>widget</i> from the status bar (without deleting it).</p>
<p>This function may cause some flicker.</p>
<p>See also <a href="qstatusbar.html#addWidget">addWidget</a>(), <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>(), and <a href="qstatusbar.html#clearMessage">clearMessage</a>().</p>
<h3 class="fn"><a name="resizeEvent" />QStatusBar.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><h3 class="fn"><a name="setSizeGripEnabled" />QStatusBar.setSizeGripEnabled (<i>self</i>, bool)</h3><h3 class="fn"><a name="showMessage" />QStatusBar.showMessage (<i>self</i>, <a href="qstring.html">QString</a> <i>text</i>, int <i>timeout</i> = 0)</h3><p>This method is also a Qt slot with the C++ signature <tt>void showMessage(const QString&,int = 0)</tt>.</p><p>Hides the normal status indications and displays the given <i>message</i> for the specified <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>
<p>See also <a href="qstatusbar.html#messageChanged">messageChanged</a>(), <a href="qstatusbar.html#currentMessage">currentMessage</a>(), and <a href="qstatusbar.html#clearMessage">clearMessage</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="messageChanged" />void messageChanged (const QString&)</h3><p>This signal is emitted whenever the temporary status message changes. The new temporary message is passed in the <i>message</i> parameter which is a null-string when the message has been removed.</p>
<p>See also <a href="qstatusbar.html#showMessage">showMessage</a>() and <a href="qstatusbar.html#clearMessage">clearMessage</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt 4.0.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.trolltech.com">Trolltech AS</a> 2006</td><td align="right" width="25%">Qt 4.1.4</td></tr></table></div></address></body></html>
|