QObject::connect(box1,SIGNAL(valueChanged(int)),slider1,SLOT(setValue(int)));
QObject::connect(slider1,SIGNAL(valueChanged(int)),box2,SLOT(setValue(int)));
QObject::connect(box2,SIGNAL(valueChanged(ing)),slider2,SLOT(setValue(int)));
QHBoxLayout *lay=new QHBoxLayout;
QVBoxLayout *veh=new QVBoxLayout;
lay->addWidget(box1);
lay->addWidget(slider1);
veh->addWidget(box2);
veh->addWidget(slider2);
get->setLayout(lay);
get->setLayout(veh);
box1->setValue(35);
get->show();
return a.exec();
为什么运行结果是这样的

------解决方案--------------------
你调用二次setLayout,这种方式 肯定是不行的了,这样它肯定只能显示一种布局的。
如果你要两个box都显示的话,建议再一个QHBoxLayout 包装一下就可以了。
------解决方案--------------------
yourSlider->setOrientation(Qt::Horizontal);