| ID | ... | Creation date | 04 January 2009 |
| Platform | S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition | Tested on devices | Emulator |
| Category | Qt for Symbian | Subcategory |
| Keywords (APIs, classes, methods, functions): QProgressBar,QSpinBox |
This code snippet demonstrates how to use a QProgressBar in Qt for Symbian.
bar->setVisible(1);
bar->setInvertedAppearance(1);
bar->setOrientation(Qt::vertical);
#ifndef PROGRESSBAR_H
#define PROGRESSBAR_H
#include <QtGui/QWidget>
#include "ui_progressbar.h"
#include <QProgressBar>
#include <QSpinBox>
#include <QVBoxLayout>
class progressbar : public QWidget
{
Q_OBJECT
public:
progressbar(QWidget *parent = 0);
~progressbar();
private:
QWidget* win;
QVBoxLayout* layout;
QProgressBar* bar;
QSpinBox* spin;
};
#endif // PROGRESSBAR_H
#include "progressbar.h"
progressbar::progressbar(QWidget *parent)
: QWidget(parent)
{
win = new QWidget(this);
win->setWindowTitle(("LCD Number"),this);
layout = new QVBoxLayout(this);
bar = new QProgressBar(this);
spin = new QSpinBox(this);
spin->setMaximum(99);
spin->setMinimum(0);
bar->resize(200,25);
bar->setOrientation(Qt::Horizontal);//Orientation can also be vertical
bar->setRange(0,99);
connect(spin , SIGNAL(valueChanged(int)), bar, SLOT(setValue(int)));
layout->addWidget(spin,Qt::AlignCenter);
layout->addWidget(bar,Qt::AlignCenter);
win->setLayout(layout);
win->showMaximized();
}
progressbar::~progressbar()
{
// No need to delete any object that has a parent which is properly deleted.
}