QMessageBox QML Type | Qt Installer Framework Manual

Qt Installer Framework Manual

# QMessageBox QML Type

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

Import Statement: | import scripting .

- List of all members, including inherited members

## 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 the given title and text.

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

Opens an information message box with the given title and text.

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

Opens a question message box with the given title and text.

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

Opens a warning message box with the given title and text.