您的位置:首页 > 编程语言 > Qt开发

QT常用控件学习

2017-05-05 17:13 302 查看
初学QT,从几个常用的控件开始,边学习边补充吧。

控件(control widget)

头文件

#include<QApplication>
#include<QLabel>
#include<QLineEdit>
#include<QPushButton>
#include<QComboBox>
#include<QCheckBox>
#include<QRadioButton>
#include<QTextEdit>
#include<QTextBrowser> //read only TextEdit
#include<QGroupBox>
#include<QSlider>
#include<QSpinBox>
#include<QDateEdit>
#include<QTimeEdit>
#include<QDateTimeEdit>
#include<QCompleter>
#include<QHBoxLayout>
#include<QVBoxLayout>
#include<QDebug>
#include<QPixmap>
#include<QLCDNumber>


QLabel

/*---QLabel---*/
QLabel *label;
lay->addWidget(new QLabel("<h1><font color=red>label</font></h1>"));
lay->addWidget(label=new QLabel("<a href=www.baidu.com>baidu</a>"));
label->setPixmap(QPixmap("../1.jpg"));
connect(label,QLabel::linkActivated,[](QString str){
qDebug()<<str;
});
/*---------------*/


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  qt 控件 widget