TQStatusBar Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQStatusBar Class Reference

The TQStatusBar class provides a horizontal bar suitable for presenting status information. More...

`#include <ntqstatusbar.h>`

Inherits TQWidget.

List of all member functions.

## Public Members

- TQStatusBar ( TQWidget * parent = 0, const char * name = 0 )
- virtual ~TQStatusBar ()
- virtual void addWidget ( TQWidget * widget, int stretch = 0, bool permanent = false )
- virtual void removeWidget ( TQWidget * widget )
- void setSizeGripEnabled ( bool )
- bool isSizeGripEnabled () const

## Public Slots

- void message ( const TQString & message )
- void message ( const TQString & message, int ms )
- void clear ()

## Signals

- void messageChanged ( const TQString & message )

## Properties

- bool sizeGripEnabled - whether the TQSizeGrip in the bottom right of the status bar is enabled

## Protected Members

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

## Detailed Description

The TQStatusBar class provides a horizontal bar suitable for presenting status information.

Each status indicator falls into one of three categories:

- Temporary - briefly occupies most of the status bar. Used to explain tool tip texts or menu entries, for example.
- Normal - 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.
- Permanent - is never hidden. Used for important mode indications, for example, some applications put a Caps Lock indicator in the status bar.

TQStatusBar lets you display all three types of indicators.

To display a temporary message, call message() (perhaps by connecting a suitable signal to it). To remove a temporary message, call clear(). There are two variants of message(): one that displays the message until the next clear() or message() and one that has a time limit:

            connect( loader, TQ_SIGNAL(progressMessage(const TQString&)),
                     statusBar(), TQ_SLOT(message(const TQString&)) );

            statusBar()->message("Loading...");  // Initial message
            loader.loadStuff();                  // Emits progress messages
            statusBar()->message("Done.", 2000); // Final message for 2 seconds

Normal and Permanent messages are displayed by creating a small widget and then adding it to the status bar with addWidget(). Widgets like TQLabel, TQProgressBar or even TQToolButton are useful for adding to status bars. removeWidget() is used to remove widgets.

            statusBar()->addWidget(new MyReadWriteIndication(statusBar()));

By default TQStatusBar provides a TQSizeGrip in the lower-right corner. You can disable it with setSizeGripEnabled(false);

See also TQToolBar, TQMainWindow, TQLabel, GUI Design Handbook: Status Bar, Main Window and Related Classes, and Help System.

## Member Function Documentation

### TQStatusBar::TQStatusBar ( TQWidget * parent = 0, const char * name = 0 )

Constructs a status bar called name with parent parent and with a size grip.

See also sizeGripEnabled.

### TQStatusBar::~TQStatusBar ()`[virtual]`

Destroys the status bar and frees any allocated resources and child widgets.

### void TQStatusBar::addWidget ( TQWidget * widget, int stretch = 0, bool permanent = false )`[virtual]`

Adds widget to this status bar. widget is reparented if it isn't already a child of the TQStatusBar.

widget is permanently visible if permanent is true and may be obscured by temporary messages if permanent is false. The default is false.

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.

stretch is used to compute a suitable size for widget as the status bar grows and shrinks. The default of 0 uses a minimum of space.

This function may cause some flicker.

See also removeWidget().

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

Removes any temporary message being shown.

See also message().

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

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

### bool TQStatusBar::isSizeGripEnabled () const

Returns true if the TQSizeGrip in the bottom right of the status bar is enabled; otherwise returns false. See the "sizeGripEnabled" property for details.

### void TQStatusBar::message ( const TQString & message )`[slot]`

Hides the normal status indicators and displays message until clear() or another message() is called.

See also clear().

Example: regexptester/regexptester.cpp.

### void TQStatusBar::message ( const TQString & message, int ms )`[slot]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Hides the normal status indications and displays message for ms milli-seconds or until clear() or another message() is called, whichever occurs first.

### void TQStatusBar::messageChanged ( const TQString & message )`[signal]`

This signal is emitted when the temporary status messages changes. message is the new temporary message, and is a null-string when the message has been removed.

See also message() and clear().

### void TQStatusBar::paintEvent ( TQPaintEvent * )`[virtual protected]`

Shows the temporary message, if appropriate.

Reimplemented from TQWidget.

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

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.

### void TQStatusBar::removeWidget ( TQWidget * widget )`[virtual]`

Removes widget from the status bar.

This function may cause some flicker.

Note that widget is not deleted.

See also addWidget().

### void TQStatusBar::setSizeGripEnabled ( bool )

Sets whether the TQSizeGrip in the bottom right of the status bar is enabled. See the "sizeGripEnabled" property for details.

## Property Documentation

### bool sizeGripEnabled

This property holds whether the TQSizeGrip in the bottom right of the status bar is enabled.

Enables or disables the TQSizeGrip in the bottom right of the status bar. By default, the size grip is enabled.

Set this property's value with setSizeGripEnabled() and get this property's value with isSizeGripEnabled().

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.