#include <QtGui>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QWidget* mainwindow = new QWidget();
QVBoxLayout* mainlayout = new QVBoxLayout();
QSlider* slider = new QSlider(Qt::Horizontal, mainwindow);
slider->setRange(0, 100);
QSpinBox* spinBox = new QSpinBox(mainwindow);
spinBox->setRange(0, 100);
QObject::connect(slider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));
QObject::connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
mainlayout->addWidget(slider);
mainlayout->addWidget(spinBox);
mainwindow->setLayout(mainlayout);
mainwindow->show();
return app.exec();
}
next: Define custom signals and slots