First, the type of message dialog
1.1 information Tip
1.2 critical error
1.3 warning warning
1.4 question asked to select (whether this action)
1.5 about
Second, the use of
1.1 information Tip
Prototype:
StandardButton QMessageBox::information(QWidget * parent, const QString & title,
const QString & text, StandardButtons buttons = Ok,
StandardButton defaultButton = NoButton) [static]
- The first parameter is a pointer to the parent control
- The second parameter is the title
- The third parameter is the content
- The fourth parameter is the window to which the number of buttons (the default is OK)
- The fifth parameter specifies the use of buttons when pressed Enter. (Default NoButton, QMessageBox case automatically selects the appropriate default.)
Return Value: StandardButton general procedure executes an action according to the particular return button value, such as the return QMessageBox :: Save, Save button pressed know , the next step to perform the save operation
- QMessageBox::Ok
- QMessageBox::Open
- QMessageBox::Save
- QMessageBox::Cancel
- QMessageBox::Close
- QMessageBox::Discard
- QMessageBox::Apply
- QMessageBox::Reset
- QMessageBox::RestoreDefaults
- QMessageBox::Help
- QMessageBox::SaveAll
- QMessageBox::Yes
- QMessageBox::YesToAll
- QMessageBox::No
- QMessageBox::NoToAll
- QMessageBox::Abort
- QMessageBox::Retry
- QMessageBox::Ignore
- QMessageBox::NoButton
Example:
QMessageBox::information(NULL, "Title", "Content", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
1.2 critical error
Prototype: ditto
Example:
QMessageBox::critical(NULL, "critical", "Content", QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes);
1.3 warning warning
Example:
QMessageBox::warning(NULL, "warning", "Content", QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes);
1.4 question 询问选择(是否需要此动作)
实例:
QMessageBox::question(NULL, "question", "Content", QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes);
1.5 about
实例:
QMessageBox::about(NULL, "About", "by hjwblog.com");