?? 3_5.cpp
字號(hào):
#include <qapplication.h>#include <qwidget.h>#include <qpushbutton.h>#include <qfont.h>#include <qlabel.h>class MyMainWindow:public QWidget{ public: MyMainWindow(); private: QPushButton *b1; QLabel *label;};MyMainWindow::MyMainWindow(){ setGeometry(100,100,200,170); b1 = new QPushButton("Quit",this); b1->setGeometry(20,20,160,80); b1->setFont(QFont("Times",18,QFont::Bold)); label = new QLabel(this); label->setGeometry(10,110,180,50); label->setText("If you click the button above, the whole program will exit"); label->setAlignment(AlignCenter); connect(b1,SIGNAL(clicked()),qApp,SLOT(quit()));}main(int argc,char **argv){ QApplication a(argc,argv); MyMainWindow w; a.setMainWidget(&w); w.show(); a.exec();}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -