eLancaster
5th December 2010, 13:53
I'm writing a program where you move a slider and the number on QLCDNumber changes accordingly. I want to add a couple of buttons which will change the base of the slider (from decimal base to binary/hexadecimal).
This is the code that i've written - the main line is in bold.
The program compiles - but when I click on the button, the base doesn't change.
What's wrong here?
QLCDNumber *lcd=new QLCDNumber(3,this);
lcd->setMode(QLCDNumber::Dec);
lcd->setGeometry(50,25,100,100);
QSlider *slide = new QSlider(Qt::Horizontal,this);
slide->setRange(0,100);
slide->setValue(0);
slide->setGeometry(50,125,100,25);
connect(slide,SIGNAL(sliderMoved(int)),lcd,SLOT(di splay(int)));
QPushButton *hex = new QPushButton("Hexadecimal",this);
hex->setFont(QFont("Times",12));
hex->setGeometry(50,200,100,25);
connect(hex,SIGNAL(clicked()),lcd,SLOT(setMode(QLC DNumber::Hex)));
This is the code that i've written - the main line is in bold.
The program compiles - but when I click on the button, the base doesn't change.
What's wrong here?
QLCDNumber *lcd=new QLCDNumber(3,this);
lcd->setMode(QLCDNumber::Dec);
lcd->setGeometry(50,25,100,100);
QSlider *slide = new QSlider(Qt::Horizontal,this);
slide->setRange(0,100);
slide->setValue(0);
slide->setGeometry(50,125,100,25);
connect(slide,SIGNAL(sliderMoved(int)),lcd,SLOT(di splay(int)));
QPushButton *hex = new QPushButton("Hexadecimal",this);
hex->setFont(QFont("Times",12));
hex->setGeometry(50,200,100,25);
connect(hex,SIGNAL(clicked()),lcd,SLOT(setMode(QLC DNumber::Hex)));