先在頭文件中包含要引用的頭文件
在類中定義成員數據和成員函數
#include<QPushButton>
private:
QPushButton *button;
在源文件中使用button
1.創建QPushButton控件
button = new QPushButton(this);
2.給控件付屬性 一般付屬性都用->
button->setGeometry(QRect(50,50,100,25));
button->setText("按鈕");
3.連接信號與槽
connect(button,SIGNAL(clicked(bool)),this,SLOT(showMainwindow2()));
