Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Fonctions  · 

QStatusBar Class Reference

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

#include <qstatusbar.h>

Inherits QWidget.

List of all member functions.

Public Members

Public Slots

  • void message ( const QString & message )
  • void message ( const QString & message, int ms )
  • void clear ()

Signals

Properties

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

Protected Members


Detailed Description

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

See also QToolBar, QMainWindow, QLabel, GUI Design Handbook: Status Bar, Main Window and Related Classes, and Help System.


Member Function Documentation

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

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

See also sizeGripEnabled.

QStatusBar::~QStatusBar () [virtual]

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

void QStatusBar::addWidget ( QWidget * 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 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.

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

bool QStatusBar::isSizeGripEnabled () const

Returns TRUE if the QSizeGrip in the bottom right of the status bar is enabled; otherwise returns FALSE. See the "sizeGripEnabled" property for details.

void QStatusBar::message ( const QString & 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 QStatusBar::message ( const QString & 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 QStatusBar::messageChanged ( const QString & 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 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. Special subclasses may need this, but geometry management will usually take care of any necessary rearrangements.

void QStatusBar::removeWidget ( QWidget * widget ) [virtual]

Removes widget from the status bar.

This function may cause some flicker.

Note that widget is not deleted.

See also addWidget().

void QStatusBar::setSizeGripEnabled ( bool )

Sets whether the QSizeGrip 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 QSizeGrip in the bottom right of the status bar is enabled.

Enables or disables the QSizeGrip 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 Qt toolkit. Copyright © 1995-2005 Trolltech. All Rights Reserved.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 82
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Le Qt Labs au hasard

Logo

Utiliser OpenCL avec Qt

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 3.3
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web