*qt_one_two<QSpinBox,QSlider,QWidget,QHBoxLayout>

 
  
#include < QApplication >
#include
< QLabel >
#include
< QPushButton >
#include
< QSpinBox >
#include
< QSlider >
#include
< QHBoxLayout >
int main( int argc, char * argv[])
{
QApplication app(argc,argv);
// QLabel* label = new QLabel("<h2><i>xxx</i>""<font color=red>xxx</font></h2>");
// label->show();
// QPushButton* button = new QPushButton("quit");
// QObject::connect(button,SIGNAL(clicked()),&app,SLOT(quit()));
// button->show();
QWidget * widget = new QWidget; // 总框架
widget -> setWindowTitle( " love " );
QSpinBox
* spinbox = new QSpinBox;
QSlider
* slider = new QSlider(Qt::Vertical);
spinbox
-> setRange( 0 , 100 );
slider
-> setRange( 0 , 100 );
QObject::connect(spinbox,SIGNAL(valueChanged(
int )),slider,SLOT(setValue( int )));
QObject::connect(slider,SIGNAL(valueChanged(
int )),spinbox,SLOT(setValue( int )));
spinbox
-> setValue( 50 );
QHBoxLayout
* layout = new QHBoxLayout;
layout
-> addWidget(spinbox);
layout
-> addWidget(slider);
widget
-> setLayout(layout);
widget
-> show();
return app.exec();
}
ps: qt 布局管理器 (QGridLayout , QVBoxLayout , QHBoxLayout)_(矩阵 垂直 竖直)

程序员的任务就是实例化所需要的控件,按照需要设置它们的属性,把它们放到布局管理器中
界面中要完成任务由Qt 的signal 和slot 完成

转载于:https://www.cnblogs.com/eth0/archive/2011/06/25/2090381.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值