To give a bit of explanation:
The program should link a spinbox and a slider so that as you change the value of one it would alter the value of the other; so at all times these would have the same value. This worked perfectly fine before but after updating it stopped working, here is my code:
#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *mainWindow = new QWidget;
mainWindow->setWindowTitle("How many chicken wings?");
QSpinBox *spinner = new QSpinBox;
QSlider *slider = new QSlider(Qt::Horizontal);
spinner->setRange(1,50);
slider->setRange(1,50);
QObject::connect(spinner, SIGNAL(valueChange(int)), slider, SLOT(setValue(int)));
QObject::connect(slider, SIGNAL(valueChange(int)), spinner, SLOT(setValue(int)));
spinner->setValue(10);
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(slider);
layout->addWidget(spinner);
mainWindow->setLayout(layout);
mainWindow->show();
return a.exec();
}
Any help would be much appreciated.
↧