Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Archived:How to use QStatusBar

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Qt Quick should be used for all UI development on mobile devices. The approach described in this article (based on QWidget) is deprecated.

This article shows how to create a QWidget based app with a status bar.

Article Metadata
Tested with
Devices(s): n800, n810, n900
Platform(s): Maemo, Symbian
Keywords: QStatusBar
Created: diegodobelo (03 Sep 2009)
Last edited: hamishwillee (11 Oct 2012)



The QMainWindow class allows the creation of a main window which provides a horizontal bar suitable for presenting status information. This bar lies on the bottom of window and can be achieved by calling the function statusBar(). This function creates and returns an object of type QStatusBar, if it does not exist.

The QStatusBar class allows addition of temporary or permanent messages and addition of QLabel, QProgressBar or QToolButton widgets.


To use QStatusBar class we need to include QStatusBar header file:

 #include <QStatusBar>


Considering that we have a QMainWindow, let’s add a temporary message (for ten seconds):

QStatusBar *status;  
status = statusBar();
status->showMessage("this is the status bar", 10000);

Optionally, let’s add a permanent widget (QLabel in this case):

QStatusBar *status;   
QLabel *label = new QLabel(this);
label->setText("this the status bar");
status = statusBar();
status->addPermanentWidget(label, 200);


On Maemo, this will display the following image when run:

Status bar.jpg

External links

This page was last modified on 11 October 2012, at 01:14.
228 page views in the last 30 days.