int main (int argc, char *argv[]){
QHBox *hbox = new QHBox;
hbox->setCaption("Slider is at : ");
hbox->setMargin(6);
hbox->setSpacing(6);
spinbox->setRange(0,100);
slider->setRange(0,100);
QObject::connect(spinbox,
SIGNAL(valueChanged
(int)), slider,
SLOT(setValue
(int)));
QObject::connect(slider,
SIGNAL(valueChanged
(int)), spinbox,
SLOT(setValue
(int)));
int x = spinbox->value();
int y = slider->value();
hbox->resize(x,y);
spinbox->setValue(11);
app.setMainWidget(hbox);
hbox->show();
return app.exec();
}
int main (int argc, char *argv[]){
QApplication app(argc, argv);
QDialog *dialog = new QDialog();
QHBox *hbox = new QHBox;
hbox->setCaption("Slider is at : ");
hbox->setMargin(6);
hbox->setSpacing(6);
QSpinBox *spinbox = new QSpinBox(hbox);
QSlider *slider = new QSlider(Qt::Horizontal, hbox);
spinbox->setRange(0,100);
slider->setRange(0,100);
QObject::connect(spinbox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
QObject::connect(slider, SIGNAL(valueChanged(int)), spinbox, SLOT(setValue(int)));
int x = spinbox->value();
int y = slider->value();
hbox->resize(x,y);
spinbox->setValue(11);
app.setMainWidget(hbox);
hbox->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks