初学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;
});
/*---------------*/