#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
//滑动条
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *window =new QWidget;
window->setWindowTitle("测试");
QSpinBox *spinbox=new QSpinBox;
QSlider *slider=new QSlider(Qt::Horizontal);
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)));
spinbox->setValue(100);
slider->setValue(100);
QHBoxLayout *layout=new QHBoxLayout;
layout->addWidget(spinbox);
layout->addWidget(slider);
window->setLayout(layout);
window->show();
return app.exec();
}