com.trolltech.qt.gui
Class QStatusBar

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QWidget
                  extended by 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:

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:

    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:

    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);
    }

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.

A status bar shown in the Plastique widget style

See Also:
QMainWindow, QStatusTipEvent, GUI Design Handbook: Status Bar, 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.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Field Summary
 QSignalEmitter.Signal1<java.lang.String> messageChanged
          This signal is emitted whenever the temporary status message changes.
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Constructor Summary
QStatusBar()
          Equivalent to QStatusBar(0).
QStatusBar(QWidget parent)
          Constructs a status bar with a size grip and the given parent.
 
Method Summary
 void addPermanentWidget(QWidget widget)
          Equivalent to addPermanentWidget(widget, 0).
 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)
          Equivalent to addWidget(widget, 0).
 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.
 boolean event(QEvent arg__1)
          This function is reimplemented for internal reasons.
static QStatusBar fromNativePointer(QNativePointer nativePointer)
          This function returns the QStatusBar instance pointed to by nativePointer
protected  void hideOrShow()
          Ensures that the right widgets are visible.
 int insertPermanentWidget(int index, QWidget widget)
          Equivalent to insertPermanentWidget(index, widget, 0).
 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)
          Equivalent to insertWidget(index, widget, 0).
 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()
          Returns whether the QSizeGrip in the bottom-right corner of the status bar is enabled.
protected  void paintEvent(QPaintEvent arg__1)
          This function is reimplemented for internal reasons.
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 (without deleting it).
protected  void resizeEvent(QResizeEvent arg__1)
          This function is reimplemented for internal reasons.
 void setSizeGripEnabled(boolean arg__1)
          Sets whether the QSizeGrip in the bottom-right corner of the status bar is enabled to arg__1.
 void showMessage(java.lang.String text)
          Equivalent to showMessage(text, 0).
 void showMessage(java.lang.String text, int timeout)
          Hides the normal status indications and displays the given text for the specified timeout milli-seconds (if non-zero), or until clearMessage or another showMessage is called, whichever occurs first.
 
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, createWinId, cursor, depth, destroy, destroy, destroy, devType, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, 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, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, 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, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintEngine, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, 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, 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, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

messageChanged

public final QSignalEmitter.Signal1<java.lang.String> messageChanged

This signal is emitted whenever the temporary status message changes. The new temporary message is passed in the text parameter which is a null-string when the message has been removed.

Compatible Slot Signatures:
void mySlot(java.lang.String text)
void mySlot()
See Also:
showMessage, clearMessage

Constructor Detail

QStatusBar

public QStatusBar()

Equivalent to QStatusBar(0).


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)

Equivalent to addPermanentWidget(widget, 0).


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, addWidget

addWidget

public final void addWidget(QWidget widget)

Equivalent to addWidget(widget, 0).


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, addPermanentWidget

clearMessage

public final void clearMessage()

Removes any temporary message being shown.

See Also:
currentMessage, showMessage, 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)

Equivalent to insertPermanentWidget(index, widget, 0).


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, addWidget

insertWidget

public final int insertWidget(int index,
                              QWidget widget)

Equivalent to insertWidget(index, widget, 0).


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, addPermanentWidget

isSizeGripEnabled

public final boolean isSizeGripEnabled()

Returns 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 (without deleting it).

See Also:
addWidget, addPermanentWidget, clearMessage

setSizeGripEnabled

public final void setSizeGripEnabled(boolean arg__1)

Sets whether the QSizeGrip in the bottom-right corner of the status bar is enabled to arg__1.

The size grip is enabled by default.

See Also:
isSizeGripEnabled

showMessage

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

Equivalent to showMessage(text, 0).


showMessage

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

Hides the normal status indications and displays the given text for the specified timeout milli-seconds (if non-zero), or until clearMessage or another showMessage is called, whichever occurs first.

See Also:
messageChanged, currentMessage, clearMessage

event

public boolean event(QEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
event in class QWidget
See Also:
closeEvent, focusInEvent, focusOutEvent, enterEvent, keyPressEvent, keyReleaseEvent, leaveEvent, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, moveEvent, paintEvent, resizeEvent, QObject::event, QObject::timerEvent

paintEvent

protected void paintEvent(QPaintEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
paintEvent in class QWidget
See Also:
event, repaint, update, QPainter, QPixmap, QPaintEvent, Analog Clock Example

resizeEvent

protected void resizeEvent(QResizeEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
resizeEvent in class QWidget
See Also:
moveEvent, event, resize, QResizeEvent, paintEvent, Example

fromNativePointer

public static QStatusBar fromNativePointer(QNativePointer nativePointer)
This function returns the QStatusBar instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.