×
Namespaces

Variants
Actions
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
{{{width}}}


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

Overview

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.

Preconditions

Installed Qt on Maemo: Getting started with Qt for Maemo

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

 #include <QStatusBar>

Example

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);
status->show();

Postconditions

If all run fine you will seen the following image:

Status bar.jpg

External links

QMainWindow API

QStatusBar API

278 page views in the last 30 days.
×