MessageBoxHandler Class | Qt Installer Framework Manual

- Qt Installer Framework Manual
- MessageBoxHandler

# MessageBoxHandler Class

(QInstaller::MessageBoxHandler)

The MessageBoxHandler class provides a modal dialog for informing the user or asking the user a question and receiving an answer. More...

Header: | #include <MessageBoxHandler>

- List of all members, including inherited members

## Public Types

enum | DefaultAction { AskUser, Accept, Reject, Default }
enum | MessageType { criticalType, informationType, questionType, warningType }

## Public Functions

int | critical(const QString &identifier, const QString &title, const QString &text, int buttons = QMessageBox::Ok, int button = QMessageBox::NoButton)
int | information(const QString &identifier, const QString &title, const QString &text, int buttons = QMessageBox::Ok, int button = QMessageBox::NoButton)
int | question(const QString &identifier, const QString &title, const QString &text, int buttons = QMessageBox::Yes | QMessageBox::No, int button = QMessageBox::NoButton)
void | setAutomaticAnswer(const QString &identifier, QMessageBox::StandardButton answer)
void | setDefaultAction(QInstaller::MessageBoxHandler::DefaultAction defaultAction)
int | warning(const QString &identifier, const QString &title, const QString &text, int buttons = QMessageBox::Ok, int button = QMessageBox::NoButton)

## Static Public Members

QMessageBox::StandardButton | critical(QWidget *parent, const QString &identifier, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton button = QMessageBox::NoButton)
QWidget * | currentBestSuitParent()
QMessageBox::StandardButton | information(QWidget *parent, const QString &identifier, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton button = QMessageBox::NoButton)
QInstaller::MessageBoxHandler * | instance()
QList<QMessageBox::Button> | orderedButtons()
QMessageBox::StandardButton | question(QWidget *parent, const QString &identifier, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No, QMessageBox::StandardButton button = QMessageBox::NoButton)
const QMetaObject | staticMetaObject
QMessageBox::StandardButton | warning(QWidget *parent, const QString &identifier, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton button = QMessageBox::NoButton)

## Detailed Description

The MessageBoxHandler class provides a modal dialog for informing the user or asking the user a question and receiving an answer.

     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:

- OK
- Open
- Save
- Cancel
- Close
- Discard
- Apply
- Reset
- RestoreDefaults
- Help
- SaveAll
- Yes
- YesToAll
- No
- NoToAll
- Abort
- Retry
- Ignore
- NoButton

## Member Type Documentation

### enum MessageBoxHandler::DefaultAction

This enum value holds the default action for the message box handler:

Constant | Value | Description
--- | --- | ---
`QInstaller::MessageBoxHandler::AskUser` | `0` | Ask the end user for confirmation.
`QInstaller::MessageBoxHandler::Accept` | `1` | Accept the message box.
`QInstaller::MessageBoxHandler::Reject` | `2` | Reject the message box.
`QInstaller::MessageBoxHandler::Default` | `3` | Uses default answer set for message box.

### enum MessageBoxHandler::MessageType

This enum value holds the severity level of the message displayed in the message box:

Constant | Value | Description
--- | --- | ---
`QInstaller::MessageBoxHandler::criticalType` | `0` | Reports critical errors.
`QInstaller::MessageBoxHandler::informationType` | `1` | Reports information about normal operations.
`QInstaller::MessageBoxHandler::questionType` | `2` | Asks a question during normal operations.
`QInstaller::MessageBoxHandler::warningType` | `3` | Reports non-critical errors.

## Member Function Documentation

### `[static]` QMessageBox::StandardButton MessageBoxHandler::critical(QWidget *parent, const QString &identifier, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton button = QMessageBox::NoButton)

### int MessageBoxHandler::critical(const QString &identifier, const QString &title, const QString &text, int buttons = QMessageBox::Ok, int button = QMessageBox::NoButton)

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

### `[static]` QWidget *MessageBoxHandler::currentBestSuitParent()

### `[static]` QMessageBox::StandardButton MessageBoxHandler::information(QWidget *parent, const QString &identifier, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton button = QMessageBox::NoButton)

### int MessageBoxHandler::information(const QString &identifier, const QString &title, const QString &text, int buttons = QMessageBox::Ok, int button = QMessageBox::NoButton)

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

### `[static]` QInstaller::MessageBoxHandler *MessageBoxHandler::instance()

### `[static]` QList<QMessageBox::Button> MessageBoxHandler::orderedButtons()

### `[static]` QMessageBox::StandardButton MessageBoxHandler::question(QWidget *parent, const QString &identifier, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No, QMessageBox::StandardButton button = QMessageBox::NoButton)

### int MessageBoxHandler::question(const QString &identifier, const QString &title, const QString &text, int buttons = QMessageBox::Yes | QMessageBox::No, int button = QMessageBox::NoButton)

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

### void MessageBoxHandler::setAutomaticAnswer(const QString &identifier, QMessageBox::StandardButton answer)

### void MessageBoxHandler::setDefaultAction(QInstaller::MessageBoxHandler::DefaultAction defaultAction)

### `[static]` QMessageBox::StandardButton MessageBoxHandler::warning(QWidget *parent, const QString &identifier, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton button = QMessageBox::NoButton)

### int MessageBoxHandler::warning(const QString &identifier, const QString &title, const QString &text, int buttons = QMessageBox::Ok, int button = QMessageBox::NoButton)

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.