QT基础教程 | QT入门 | 信号与槽







、、、、、、、、、、、、、、、、、、、、


infoLabel->setText("input cmd:");
#include <QApplication>//应用,面向对象
#include <QLabel>//tag header file ,create a label
#include <QLineEdit>
#include <QPushiButton>
#include <QHBoxLayout>//horizontal layout水平布局
#include <QVBoxLayout>//vertical layout垂直布局
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
QLable *infoLabel()=new QLabel;
QLable *openLabel()=new QLabel;
QLineEdit *cmdLineEdit=new QLineEdit;
QPushButton *commitButton=new QPushButton;
QPushButton *cancelButton=new QPushButton;
QPushButton *browseButton=new QPushButton;
infoLabel->setText("input cmd:");
openLabe->setText("open");
commitButton->setText("commit");
cancelButton->setText("cancel");
browseButton->setText("browse");
QHBoxLayout *cmdLayout=new QHBoxLayout;//horizontal layout object/水平布局对象;
cmdLayout->addWidget(openLabel);//Add spacebar to horizontal object将控件加到水平对象里
//addWidget()添加控件
cmdLayout->addWidget(cmdLineEdit);
return app.exec();
}

控件,标签,行编辑框,文本编辑框,文字,布局,水平布局对象(布局也是对象),