# QStatusBar Class Reference

The QStatusBar class provides a horizontal bar suitable for presenting status messages. More...

`#include <qstatusbar.h>`

Inherits QWidget.

List of all member functions.

## Public Members

- QStatusBar ( QWidget * parent = 0, const char * name = 0 )
- ~QStatusBar ()
- void addWidget ( QWidget *, int, bool = FALSE )
- void removeWidget ( QWidget * )

## Public Slots

- void message ( const char * )
- void message ( const char *, int )
- void clear ()

## Protected Members

- virtual void paintEvent ( QPaintEvent * )
- void reformat ()
- void hideOrShow ()

## Detailed Description

The QStatusBar class provides a horizontal bar suitable for presenting status messages.

Each status message falls into one of three classes:

- `Temporary` - occupies most of the status bar briefly. Used e.g. for explaining tool tip texts or menu entries)

- `Normal` - occupies part of the status bar and may be hidden by temporary messages. Used e.g. for displaying the page and line number in a word processor.

- `Permanent` - occupies the far right of the statusbar and is never hidden. Used for important mode indications. Some applications put a Caps Lock indicator here.

QStatusBar lets you display all three sorts of messages.

To display a temporary message, you can call message(), or connect a suitable signal to it. To remove a temporary message, you can call clear(), or connect a signal to it.

There are two variants of message(), one which displays the message until the next clear() or mesage(), and one which also has a time limit.

Normal and permanent messages are displayed by creating a widget (typically a QLabel) and using addWidget() to add this widget to the status bar.

Finally, in Windows style QStatusBar also provides a Windows standard resize handle. In the X11 version Qt 1.40 this resize handle generally works differently than the one provided by the system; we hope to reduce this difference in the future.

See also: QToolBar, QMainWindow, QLabel, Microsoft Style Guide, and GUI Design Handbook: Status Bar.

## Member Function Documentation

### QStatusBar::QStatusBar ( QWidget * parent = 0, const char * name = 0 )

Constructs an empty status bar.

### QStatusBar::~QStatusBar ()

Destroys the object and frees any allocated resources.

### void QStatusBar::addWidget ( QWidget * widget, int stretch, bool permanent = FALSE )

Adds widget to this status bar, with a width of stretch.

widget is permanently visible if permanent is TRUE, and is obscured by temporary messages if permanent is FALSE. The default is FALSE.

stretch is used to compute a suitable size for widget.

If permanent is TRUE, widget is located at the far right of the status bar. If permanent is FALSE (the default) widget is located just to the left of the first permanent widget.

This function may cause some flicker.

See also: removeWidget().

### void QStatusBar::clear () `[slot]`

Removes any temporary message being shown.

See also: message().

### void QStatusBar::hideOrShow () `[protected]`

Ensures that the right widgets are visible. Used by message() and clear().

### void QStatusBar::message ( const char * message ) `[slot]`

Hide the normal status indications and display message, until clear() or another message() is called.

See also: clear().

### void QStatusBar::message ( const char * message, int ms ) `[slot]`

Hide the normal status indications and display message for ms milli-seconds, or until clear() or another message() is called, whichever is shorter.

### void QStatusBar::paintEvent ( QPaintEvent * ) `[virtual protected]`

Shows the temporary message, if appropriate.

Reimplemented from QWidget.

### void QStatusBar::reformat () `[protected]`

Changes the status bar's appearance to account for item changes.

### void QStatusBar::removeWidget ( QWidget * widget )

Removes widget from the status bar.

This function may cause some flicker.

Note that widget is not deleted.

See also: addWidget().

Search the documentation, FAQ, qt-interest archive and more (uses www.troll.no):

This file is part of the Qt toolkit, copyright © 1995-99 Troll Tech, all rights reserved.

It was generated from the following files:

- qstatusbar.h: 1998/08/19
- qstatusbar.cpp: 1999/01/11