qt common message dialog

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]

 

  1. The first parameter is a pointer to the parent control
  2. The second parameter is the title
  3. The third parameter is the content
  4. The fourth parameter is the window to which the number of buttons (the default is OK)
  5. 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


  1. QMessageBox::Ok
  2. QMessageBox::Open
  3. QMessageBox::Save
  4. QMessageBox::Cancel
  5. QMessageBox::Close
  6. QMessageBox::Discard
  7. QMessageBox::Apply
  8. QMessageBox::Reset
  9. QMessageBox::RestoreDefaults
  10. QMessageBox::Help
  11. QMessageBox::SaveAll
  12. QMessageBox::Yes
  13. QMessageBox::YesToAll
  14. QMessageBox::No
  15. QMessageBox::NoToAll
  16. QMessageBox::Abort
  17. QMessageBox::Retry
  18. QMessageBox::Ignore
  19. 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");

 

Guess you like

Origin www.cnblogs.com/shenLong1356/p/11184335.html