我照例子
#include <QApplication>
#include <QSpinBox>
#include <QSlider>
#include <QHBoxLayout>
int main(int argc,char**argv)
{
QApplication app(argc,argv);
QWidget *window=new QWidget;
window->setWindowTitle("How old are you?");
QSpinBox * spinbox = new QSpinBox;
QSlider * slider = new QSlider(Qt::Horizontal);
spinbox->setRange(0,130);
slider->setRange(0,130);
QObject::connect(spinbox,SIGNAL(ValueChanged(int)),slider,
SLOT(setValue(int))); QObject::connect(slider,SIGNAL(ValueChanged(int)),spinbox,
SLOT(setValue(int)));
spinbox->setValue(14);
QHBoxLayout *layout=new QHBoxLayout;
layout->addWidget(spinbox);
layout->addWidget(slider);
window->setLayout(layout);
window->show();
return app.exec();}
发现滑动时,另一个部件的数值不变,求助啊