码迷,mamicode.com
首页 > 其他好文 > 详细

SIGNAL & SLOT

时间:2014-05-21 19:19:08      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   c   code   java   

bubuko.com,布布扣
 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 }
bubuko.com,布布扣

 

SIGNAL & SLOT,布布扣,bubuko.com

SIGNAL & SLOT

标签:style   blog   class   c   code   java   

原文地址:http://www.cnblogs.com/yongjiuzhizhen/p/3740117.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!