1. 函数原型
void about ( QWidget * parent, const QString & title, const QString & text)
void aboutQt ( QWidget * parent, const QString & title = QString ( ) )
QMessageBox:: StandardButton critical ( QWidget * parent, const QString & title, const QString & text, QMessageBox:: StandardButtons buttons = Ok, QMessageBox:: StandardButton defaultButton = NoButton)
QMessageBox:: StandardButton information ( QWidget * parent, const QString & title, const QString & text, QMessageBox:: StandardButtons buttons = Ok, QMessageBox:: StandardButton defaultButton = NoButton)
QMessageBox:: StandardButton question ( QWidget * parent, const QString & title, const QString & text, QMessageBox:: StandardButtons buttons = StandardButtons ( Yes | No) , QMessageBox:: StandardButton defaultButton = NoButton)
QMessageBox:: StandardButton warning ( QWidget * parent, const QString & title, const QString & text, QMessageBox:: StandardButtons buttons = Ok, QMessageBox:: StandardButton defaultButton = NoButton)
2. 显示效果
2.1 about
2.2 aboutQt
2.3 critical
2.4 information
2.5 question
2.6 warning
3. 代码
QMessageBox:: about ( this, "测试" , "about" ) ;
QMessageBox:: aboutQt ( this, "aboutQt" ) ;
QMessageBox:: critical ( this, "测试" , "critical" , QMessageBox:: Ok, QMessageBox:: NoButton) ;
QMessageBox:: information ( this, "测试" , "information" , QMessageBox:: Ok, QMessageBox:: NoButton) ;
QMessageBox:: question ( this, "测试" , "question" , QMessageBox:: Ok, QMessageBox:: NoButton) ;
QMessageBox:: warning ( this, "测试" , "warning" , QMessageBox:: Ok, QMessageBox:: NoButton) ;