test.cpp~
来自「qt 固定框架」· CPP~ 代码 · 共 45 行
CPP~
45 行
#include<qapplication.h>#include<qwidget.h>#include<qpushbutton.h>#include<qfont.h>#include<qlabel.h>class MyMainWin:public QWidget{ public: MyMainWin(); private: QPushButton *b1; QLabel *label;};MyMainWin::MyMainWin(){//setMinimumSize(200,120); //setMaximumSize(400,240); setGeometry(100,100,200,120); // b1=new QPushButton("Button 1",this); b1=new QPushButton("Quit ",this); b1->setGeometry(20,20,160,80); b1->setFont(QFont("Times",18,QFont::Bold),true); label=new QLabel(this); label->setGeometry(20,110,180,50); label->setText("If you click the buttonabove,\n the whole program will exit! "); label->setAlignment(AlignCenter);}int main(int argc,char **argv){ QApplication a(argc,argv); MyMainWin w; a.setMainWidget(&w); w.show(); a.exec(); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?