QMessageBox

Provides a modal dialog for informing the user or asking the user a question and receiving an answer. More...

Methods

  • Button critical(string identifier, string title, string text, Buttons buttons, Button button)
  • Button information(string identifier, string title, string text, Buttons buttons, Button button)
  • Button question(string identifier, string title, string text, Buttons buttons, Button button)
  • Button warning(string identifier, string title, string text, Buttons buttons, Button button)

Detailed Description

var result = QMessageBox.question("quit.question", "Installer", "Do you want to quit the installer?",
                                  QMessageBox.Yes | QMessageBox.No);
if (result == QMessageBox.Yes) {
   // ...
}

Buttons in Message Boxes

QMessageBox defines a list of common buttons:

  • 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

Scripted Installations

Sometimes it is useful to automatically close message boxes, for example during a scripted installation. This can be achieved by calling installer::setMessageBoxAutomaticAnswer, installer::autoAcceptMessageBoxes or installer::autoRejectMessageBoxes. The identifier argument in the method calls allows to identify specific message boxes for this purpose.

Method Documentation

Button critical(string identifier, string title, string text, Buttons buttons = QMessageBox.Ok, Button button = QMessageBox.NoButton)

Opens a critical message box with identifier identifier, title title, text text, default buttons buttons and button button selected by default.


Button information(string identifier, string title, string text, Buttons buttons = QMessageBox.Ok, Button button = QMessageBox.NoButton)

Opens an information message box with identifier identifier, title title, text text, default buttons buttons and button button selected by default.


Button question(string identifier, string title, string text, Buttons buttons = QMessageBox.Yes | QMessageBox.No, Button button = QMessageBox.NoButton)

Opens a question message box with identifier identifier, title title, text text, default buttons buttons and button button selected by default.


Button warning(string identifier, string title, string text, Buttons buttons = QMessageBox.Ok, Button button = QMessageBox.NoButton)

Opens a warning message box with identifier identifier, title title, text text, default buttons buttons and button button selected by default.


© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.