class Mywidget : public QWidget
{
Q_OBJECT
public:
explicit Mywidget(QWidget *parent = 0);
signals:
public slots:
private:
QPushButton* TestPushButton;
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Mywidget TestMywidget(0);
TestMywidget.setGeometry(1000, 1000, 1000, 1000 );
TestMywidget.show();
return a.exec();
// while(1);
}
s
Mywidget::Mywidget(QWidget *parent) :
QWidget(parent)
{
setMinimumSize( 1000, 1000 );/*设定QWidget 最小值*/
setMaximumSize( 1000, 1000 );/*设定QWidget 最大值*/
TestPushButton = new QPushButton("TEST", this);
TestPushButton->setGeometry( 100, 100, 500, 500 );//设定按钮大小
TestPushButton->setFont(QFont( "Times", 18, QFont::Bold ) );
connect(TestPushButton, SIGNAL(clicked()), qApp, SLOT(quit()) );
}