主代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
QWidget *window= new QWidget();
window->setWindowTitle( "hello" );
QSpinBox *spinBox= new QSpinBox();
QSlider *slider= new QSlider(Qt::Horizontal);
spinBox->setRange(100,1000);
slider->setRange(100,1000);
spinBox->setValue(100);
QObject::connect(slider,SIGNAL(valueChanged( int )),spinBox,SLOT(setValue( int )));
QObject::connect(spinBox,SIGNAL(valueChanged( int )),slider,SLOT(setValue( int )));
QHBoxLayout *layout= new QHBoxLayout();
layout->addWidget(spinBox);
layout->addWidget(slider);
window->setLayout(layout);
window->show();
return a.exec();
|
==============================================================================
本文转自被遗忘的博客园博客,原文链接:http://www.cnblogs.com/rollenholt/archive/2011/11/24/2262175.html,如需转载请自行联系原作者