功能和pushButton类型,其他类似,
只是将mywidget中改成了
#include "mywidget.h"#include#include #include MyWidget::MyWidget(QWidget *parent) : QWidget(parent){ setMinimumSize( 200, 120 ); setMaximumSize( 200, 120 ); QToolButton *quit = new QToolButton(this); quit->setText("quit"); quit->setGeometry( 62, 40, 75, 30 ); quit->setFont( QFont( "Times", 18, QFont::Bold ) ); connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );}MyWidget::~MyWidget(){}