Home

A simple example of the Thumb Wheel component

This example shows a thumb-wheel widget whose value range is set from -100 to 100. An LCDNumber display shows the value of the thumb-wheel.


#include <qapplication.h>
#include <qlcdnumber.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qtthumbwheel.h>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QDialog dialog;

    QtThumbWheel *wheel = new QtThumbWheel(&dialog);
    wheel->setRange(-100, 100);

    QLCDNumber *lcd = new QLCDNumber(&dialog);
    QObject::connect(wheel, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));

    QVBoxLayout *vbox = new QVBoxLayout(&dialog);
    vbox->addWidget(wheel);
    vbox->addWidget(lcd);

    app.setMainWidget(&dialog);

    dialog.show();
    return app.exec();
}

Copyright © 2003-2006 TrolltechTrademarks
Qt Solutions