The QStatusBar class provides a horizontal bar suitable for presenting status information.
QStatusBar lets you display all three types of indicators.
Normal and Permanent messages are displayed by creating a small widget (QLabel, QProgressBar or even QToolButton) and then adding it to the status bar using the addWidget() or the addPermanentWidget() function. Use the removeWidget() function to remove such messages from the status bar.
statusBar()->addWidget(new MyReadWriteIndication);
By default QStatusBar provides a QSizeGrip in the lower-right corner. You can disable it using the setSizeGripEnabled() function. Use the isSizeGripEnabled() function to determine the current status of the size grip.
See also QMainWindow, QStatusTipEvent, GUI Design Handbook: Status Bar, and Application Example.
Property Documentation
sizeGripEnabled : bool
This property holds whether the QSizeGrip in the bottom-right corner of the status bar is enabled.
The size grip is enabled by default.
Access functions:
- bool isSizeGripEnabled () const
- void setSizeGripEnabled ( bool )
Member Function Documentation
QStatusBar::QStatusBar ( QWidget * parent = 0 )
Constructs a status bar with a size grip and the given parent.
See also setSizeGripEnabled().
QStatusBar::~QStatusBar () [virtual]
Destroys this status bar and frees any allocated resources and child widgets.
void QStatusBar::addPermanentWidget ( QWidget * widget, int stretch = 0 )
Adds the given widget permanently to this status bar, reparenting the widget if it isn't already a child of this QStatusBar object. The stretch parameter is used to compute a suitable size for the given widget as the status bar grows and shrinks. The default stretch factor is 0, i.e giving the widget a minimum of space.
Permanently means that the widget may not be obscured by temporary messages. It is is located at the far right of the status bar.
See also insertPermanentWidget(), removeWidget(), and addWidget().
void QStatusBar::addWidget ( QWidget * widget, int stretch = 0 )
Adds the given widget to this status bar, reparenting the widget if it isn't already a child of this QStatusBar object. The stretch parameter is used to compute a suitable size for the given widget as the status bar grows and shrinks. The default stretch factor is 0, i.e giving the widget a minimum of space.
The widget is located to the far left of the first permanent widget (see addPermanentWidget()) and may be obscured by temporary messages.
See also insertWidget(), removeWidget(), and addPermanentWidget().
void QStatusBar::clearMessage () [slot]
Removes any temporary message being shown.
See also currentMessage(), showMessage(), and removeWidget().
QString QStatusBar::currentMessage () const
Returns the temporary message currently shown, or an empty string if there is no such message.
See also showMessage().
void QStatusBar::hideOrShow () [protected]
Ensures that the right widgets are visible.
Used by the showMessage() and clearMessage() functions.
int QStatusBar::insertPermanentWidget ( int index, QWidget * widget, int stretch = 0 )
Inserts the given widget at the given index permanently to this status bar, reparenting the widget if it isn't already a child of this QStatusBar object. If index is out of range, the widget is appended (in which case it is the actual index of the widget that is returned).
The stretch parameter is used to compute a suitable size for the given widget as the status bar grows and shrinks. The default stretch factor is 0, i.e giving the widget a minimum of space.
Permanently means that the widget may not be obscured by temporary messages. It is is located at the far right of the status bar.
This function was introduced in Qt 4.2.
See also addPermanentWidget(), removeWidget(), and addWidget().
int QStatusBar::insertWidget ( int index, QWidget * widget, int stretch = 0 )
Inserts the given widget at the given index to this status bar, reparenting the widget if it isn't already a child of this QStatusBar object. If index is out of range, the widget is appended (in which case it is the actual index of the widget that is returned).
The stretch parameter is used to compute a suitable size for the given widget as the status bar grows and shrinks. The default stretch factor is 0, i.e giving the widget a minimum of space.
The widget is located to the far left of the first permanent widget (see addPermanentWidget()) and may be obscured by temporary messages.
This function was introduced in Qt 4.2.
See also addWidget(), removeWidget(), and addPermanentWidget().
void QStatusBar::messageChanged ( const QString & message ) [signal]
This signal is emitted whenever the temporary status message changes. The new temporary message is passed in the message parameter which is a null-string when the message has been removed.
See also showMessage() and clearMessage().
void QStatusBar::reformat () [protected]
Changes the status bar's appearance to account for item changes.
Special subclasses may need this function, but geometry management will usually take care of any necessary rearrangements.
void QStatusBar::removeWidget ( QWidget * widget )
Removes the specified widget from the status bar.
Note: This function does not delete the widget but hides it. To add the widget again, you must call both the addWidget() and show() functions.
See also addWidget(), addPermanentWidget(), and clearMessage().
void QStatusBar::showMessage ( const QString & message, int timeout = 0 ) [slot]
Hides the normal status indications and displays the given message for the specified number of milli-seconds (timeout). If timeout is 0 (default), the message remains displayed until the clearMessage() slot is called or until the showMessage() slot is called again to change the message.
Note that showMessage() is called to show temporary explanations of tool tip texts, so passing a timeout of 0 is not sufficient to display a permanent message.
See also messageChanged(), currentMessage(), and clearMessage().