Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QStatusBar

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.gui.QWidget
                          com.trolltech.qt.gui.QStatusBar

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

    public class QStatusBar

extends QWidget

The `QStatusBar` 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.

`QStatusBar` lets you display all three types of indicators.

Typically, a request for the status bar functionality occurs in relation to a `QMainWindow` object. `QMainWindow` provides a main application window, with a menu bar, tool bars, dock widgets and a status bar around a large central widget. The status bar can be retrieved using the `QMainWindow::statusBar()` function, and replaced using the `QMainWindow::setStatusBar()` function.

Use the `showMessage()` slot to display a temporary message:
The following code example is written in c++.

    void MainWindow::createStatusBar()
    {
        statusBar()->showMessage(tr("Ready"));
    }

To remove a temporary message, use the `clearMessage()` slot, or set a time limit when calling `showMessage()`. For example:
The following code example is written in c++.

    void MainWindow::print()
    {
    #ifndef QT_NO_PRINTER
        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);
    #endif
    }

Use the `currentMessage()` function to retrieve the temporary message currently shown. The `QStatusBar` class also provide the `messageChanged()` signal which is emitted whenever the temporary status message changes. 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.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
`QWidget.RenderFlag, QWidget.RenderFlags`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary
`QSignalEmitter.Signal1` | `messageChanged` This signal takes 1 generic argument(s).

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QStatusBar()` Constructs a status bar with a size grip and the given `parent`.
`QStatusBar(QWidget parent)` Constructs a status bar with a size grip and the given `parent`.

Method Summary
`void` | `addPermanentWidget(QWidget widget)` Adds the given `widget` permanently to this status bar, reparenting the widget if it isn't already a child of this `QStatusBar` object.
`void` | `addPermanentWidget(QWidget widget, int stretch)` Adds the given `widget` permanently to this status bar, reparenting the widget if it isn't already a child of this `QStatusBar` object.
`void` | `addWidget(QWidget widget)` Adds the given `widget` to this status bar, reparenting the widget if it isn't already a child of this `QStatusBar` object.
`void` | `addWidget(QWidget widget, int stretch)` Adds the given `widget` to this status bar, reparenting the widget if it isn't already a child of this `QStatusBar` object.
`void` | `clearMessage()` Removes any temporary message being shown.
`java.lang.String` | `currentMessage()` Returns the temporary message currently shown, or an empty string if there is no such message.
`protected void` | `hideOrShow()` Ensures that the right widgets are visible.
`int` | `insertPermanentWidget(int index, QWidget widget)` 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.
`int` | `insertPermanentWidget(int index, QWidget widget, int stretch)` 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.
`int` | `insertWidget(int index, QWidget widget)` 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.
`int` | `insertWidget(int index, QWidget widget, int stretch)` 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.
`boolean` | `isSizeGripEnabled()` This property holds whether the `QSizeGrip` in the bottom-right corner of the status bar is enabled.
`protected void` | `reformat()` Changes the status bar's appearance to account for item changes.
`void` | `removeWidget(QWidget widget)` Removes the specified `widget` from the status bar.
`void` | `setSizeGripEnabled(boolean arg__1)` This property holds whether the `QSizeGrip` in the bottom-right corner of the status bar is enabled.
`void` | `showMessage(java.lang.String text)` Hides the normal status indications and displays the given `message` for the specified number of milli-seconds (`timeout`).
`void` | `showMessage(java.lang.String text, int timeout)` Hides the normal status indications and displays the given `message` for the specified number of milli-seconds (`timeout`).

Methods inherited from class com.trolltech.qt.gui.QWidget
`acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### messageChanged

    public final QSignalEmitter.Signal1 messageChanged

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.String(named: message)>:

  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()`.

Constructor Detail

### QStatusBar

    public QStatusBar()

  Constructs a status bar with a size grip and the given `parent`.

See also:
  `setSizeGripEnabled()`.

### QStatusBar

    public QStatusBar(QWidget parent)

  Constructs a status bar with a size grip and the given `parent`.

See also:
  `setSizeGripEnabled()`.

Method Detail

### addPermanentWidget

    public final void addPermanentWidget(QWidget widget)

  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()`.

### addPermanentWidget

    public final void addPermanentWidget(QWidget widget,
                                         int stretch)

  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()`.

### addWidget

    public final void addWidget(QWidget widget)

  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()`.

### addWidget

    public final void addWidget(QWidget widget,
                                int stretch)

  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()`.

### clearMessage

    public final void clearMessage()

  Removes any temporary message being shown.

See also:
  `currentMessage()`, `showMessage()`, and `removeWidget()`.

### currentMessage

    public final java.lang.String currentMessage()

  Returns the temporary message currently shown, or an empty string if there is no such message.

See also:
  `showMessage()`.

### hideOrShow

    protected final void hideOrShow()

  Ensures that the right widgets are visible.

  Used by the `showMessage()` and `clearMessage()` functions.

### insertPermanentWidget

    public final int insertPermanentWidget(int index,
                                           QWidget widget)

  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.

See also:
  `addPermanentWidget()`, `removeWidget()`, and `addWidget()`.

### insertPermanentWidget

    public final int insertPermanentWidget(int index,
                                           QWidget widget,
                                           int stretch)

  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.

See also:
  `addPermanentWidget()`, `removeWidget()`, and `addWidget()`.

### insertWidget

    public final int insertWidget(int index,
                                  QWidget widget)

  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.

See also:
  `addWidget()`, `removeWidget()`, and `addPermanentWidget()`.

### insertWidget

    public final int insertWidget(int index,
                                  QWidget widget,
                                  int stretch)

  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.

See also:
  `addWidget()`, `removeWidget()`, and `addPermanentWidget()`.

### isSizeGripEnabled

    public final boolean isSizeGripEnabled()

  This property holds whether the `QSizeGrip` in the bottom-right corner of the status bar is enabled. The size grip is enabled by default.

### reformat

    protected final void reformat()

  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.

### removeWidget

    public final void 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()`.

### setSizeGripEnabled

    public final void setSizeGripEnabled(boolean arg__1)

  This property holds whether the `QSizeGrip` in the bottom-right corner of the status bar is enabled. The size grip is enabled by default.

### showMessage

    public final void showMessage(java.lang.String text)

  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()`.

### showMessage

    public final void showMessage(java.lang.String text,
                                  int timeout)

  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()`.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD