Eneboo - Documentación para desarrolladores
|
The QStatusBar class provides a horizontal bar suitable for presenting status information. Más...
#include <qstatusbar.h>
Slots públicos | |
void | message (const QString &) |
void | message (const QString &, int) |
void | clear () |
void | message (const QString &) |
void | message (const QString &, int) |
void | clear () |
Señales | |
void | messageChanged (const QString &text) |
void | messageChanged (const QString &text) |
Métodos públicos | |
QStatusBar (QWidget *parent=0, const char *name=0) | |
virtual | ~QStatusBar () |
virtual void | addWidget (QWidget *, int stretch=0, bool=FALSE) |
virtual void | removeWidget (QWidget *) |
void | setSizeGripEnabled (bool) |
bool | isSizeGripEnabled () const |
QStatusBar (QWidget *parent=0, const char *name=0) | |
virtual | ~QStatusBar () |
virtual void | addWidget (QWidget *, int stretch=0, bool=FALSE) |
virtual void | removeWidget (QWidget *) |
void | setSizeGripEnabled (bool) |
bool | isSizeGripEnabled () const |
Métodos protegidos | |
void | paintEvent (QPaintEvent *) |
void | resizeEvent (QResizeEvent *) |
void | reformat () |
void | hideOrShow () |
bool | event (QEvent *) |
void | paintEvent (QPaintEvent *) |
void | resizeEvent (QResizeEvent *) |
void | reformat () |
void | hideOrShow () |
bool | event (QEvent *) |
Propiedades | |
bool | sizeGripEnabled |
whether the QSizeGrip in the bottom right of the status bar is enabled |
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.
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, SIGNAL(progressMessage(const QString&)), statusBar(), SLOT(message(const QString&)) ); 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 QLabel, QProgressBar or even QToolButton are useful for adding to status bars. removeWidget() is used to remove widgets.
statusBar()->addWidget(new MyReadWriteIndication(statusBar()));
By default QStatusBar provides a QSizeGrip in the lower-right corner. You can disable it with setSizeGripEnabled(FALSE);
QStatusBar::QStatusBar | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
Constructs a status bar called name with parent parent and with a size grip.
QStatusBar::~QStatusBar | ( | ) | [virtual] |
Destroys the status bar and frees any allocated resources and child widgets.
QStatusBar::QStatusBar | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
virtual QStatusBar::~QStatusBar | ( | ) | [virtual] |
Adds widget to this status bar. widget is reparented if it isn't already a child of the QStatusBar.
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.
void QStatusBar::clear | ( | ) | [slot] |
void QStatusBar::clear | ( | void | ) | [slot] |
Removes any temporary message being shown.
This is the main event handler; it handles event e. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.
Key press and release events are treated differently from other events. event() checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event() calls keyPressEvent().
This function returns TRUE if it is able to pass the event over to someone (i.e. someone wanted the event); otherwise returns FALSE.
Reimplementado de QWidget.
void QStatusBar::hideOrShow | ( | ) | [protected] |
void QStatusBar::hideOrShow | ( | ) | [protected] |
bool QStatusBar::isSizeGripEnabled | ( | ) | const |
bool QStatusBar::isSizeGripEnabled | ( | ) | const |
void QStatusBar::message | ( | const QString & | ) | [slot] |
void QStatusBar::message | ( | const QString & | message | ) | [slot] |
QStatusBar::messageChanged | ( | const QString & | message | ) | [signal] |
void QStatusBar::messageChanged | ( | const QString & | text | ) | [signal] |
void QStatusBar::paintEvent | ( | QPaintEvent * | ) | [protected, virtual] |
Shows the temporary message, if appropriate.
Reimplementado de QWidget.
void QStatusBar::paintEvent | ( | QPaintEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive paint events.
A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint() or update(), or because the widget was obscured and has now been uncovered, or for many other reasons.
Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QCanvas do this, for example.
Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::unite()). repaint() does not permit this optimization, so we suggest using update() when possible.
When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background. There are a couple of exceptions and QPaintEvent::erased() tells you whether the widget has been erased or not.
The background can be set using setBackgroundMode(), setPaletteBackgroundColor() or setBackgroundPixmap(). The documentation for setBackgroundMode() elaborates on the background; we recommend reading it.
Reimplementado de QWidget.
void QStatusBar::reformat | ( | ) | [protected] |
void QStatusBar::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.
virtual void QStatusBar::removeWidget | ( | QWidget * | ) | [virtual] |
void QStatusBar::removeWidget | ( | QWidget * | widget | ) | [virtual] |
Removes widget from the status bar.
This function may cause some flicker.
Note that widget is not deleted.
void QStatusBar::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
Reimplementado de QWidget.
void QStatusBar::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget resize events. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().
The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.
Widgets that have been created with the WNoAutoErase
flag will not be erased. Nevertheless, they will receive a paint event for their entire area afterwards. Again, no drawing needs to be done inside this handler.
The default implementation calls updateMask() if the widget has automatic masking enabled.
Reimplementado de QWidget.
void QStatusBar::setSizeGripEnabled | ( | bool | enabled | ) |
void QStatusBar::setSizeGripEnabled | ( | bool | ) |
bool QStatusBar::sizeGripEnabled [read, write] |