标签:style blog class c code java
1 #include <QApplication> 2 #include <QHBoxLayout> 3 #include <QSlider> 4 #include <QSpinBox> 5 6 int main(int argc, char *argv[]) 7 { 8 QApplication app(argc, argv); 9 10 QWidget *window = new QWidget; 11 window->setWindowTitle("Enter Your Age"); 12 13 QSpinBox *spinBox = new QSpinBox; 14 QSlider *slider = new QSlider(Qt::Horizontal); 15 16 spinBox->setRange(0,130); 17 slider->setRange(0,130); 18 19 QObject::connect(spinBox,SIGNAL(valueChanged(int)),slider,SLOT(setValue(int))); 20 QObject::connect(slider,SIGNAL(valueChanged(int)),spinBox,SLOT(setValue(int))); 21 22 spinBox->setValue(35); 23 24 QHBoxLayout *layout = new QHBoxLayout; 25 layout->addWidget(spinBox); 26 layout->addWidget(slider); 27 window->setLayout(layout); 28 29 window->show(); 30 31 return app.exec(); 32 }
标签:style blog class c code java
原文地址:http://www.cnblogs.com/yongjiuzhizhen/p/3740117.html