Reputation: 11
why do i get error in this code on line 17 and 18 Q::object... it says that i need to put ')' before the ';' i am confused please help.
#include <QtGui>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char *argv[]){
QGuiApplication prog(argc, argv);
QWidget *mainWindow = new QWidget;
mainWindow->setWindowTitle("how many chickens do you want");
QSpinBox *spinner = new QSpinBox;
QSlider *slider = new QSlider(Qt::Horizontal);
spinner->setRange(1,50);
slider->setRange(1,50);
QObject::connect(spinner, SIGNAL(valueChanged(int)),slider, SLOT(setValue(int));
QObject::connect(slider, SIGNAL(valueChanged(int)),spinner, SLOT(setValue(int));
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(spinner);
layout->addWidget(slider);
mainWindow->setLayout(layout);
mainWindow->show();
Upvotes: 0
Views: 40
Reputation: 51
You're short one ')' in each line. Try this:
QObject::connect(spinner, SIGNAL(valueChanged(int)),slider, SLOT(setValue(int)));
QObject::connect(slider, SIGNAL(valueChanged(int)),spinner, SLOT(setValue(int)));
Upvotes: 2