1 MainWindow::MainWindow(QWidget *parent) : 2 QMainWindow(parent), 3 ui(new Ui::MainWindow) 4 { 5 ui->setupUi(this); 6 //设置最小大小 7 this->setMinimumSize(200,100); 8 9 QPushButton *push=new QPushButton("quit",this); 10 //设置大小和位置 11 push->setGeometry(64,40,76,33); 12 //设置字体 13 push->setFont(QFont("Times",25,QFont::Bold)); 14 //程序结构 15 connect(push,SIGNAL(clicked(bool)),qApp,SLOT(quit())); 16 }