Revision as of 11:56, 9 September 2009 by nayan_trivedi (Talk | contribs)

Archived:How to use QStatusBar

From Nokia Developer Wiki
Jump to: navigation, search

Article Metadata
Tested with
Devices(s): n800, n810, n900
Platform(s): Maemo
Keywords: Qt, maemo, main window, status bar
Created: (09 Mar 2009)
Last edited: nayan_trivedi (09 Sep 2009)


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 exists. The QStatusBar class allows addition of temporary or permanent messages and addition of QLabel, QProgressBar or QToolButton widgets.


Installed Qt on Maemo: Getting started with Qt for Maemo

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


If all run fine you will seen the following image:

Status bar.jpg

External links

QMainWindow API

QStatusBar API

225 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.