Extending Qt Creator Manual | CheckableMessageBox

Extending Qt Creator Manual 4.6.1

# CheckableMessageBox Class

(Utils::CheckableMessageBox)

The CheckableMessageBox class implements a message box suitable for questions with a "Do not ask me again" checkbox. More...

Header: | #include <CheckableMessageBox>

- List of all members, including inherited members

## Properties

- buttons : QDialogButtonBox::StandardButtons
- checkBoxText : QString
- defaultButton : QDialogButtonBox::StandardButton

- iconPixmap : QPixmap
- isChecked : bool
- text : QString

## Public Functions

| CheckableMessageBox(QWidget *parent)
virtual | ~CheckableMessageBox()
QPushButton * | addButton(const QString &text, QDialogButtonBox::ButtonRole role)
QPushButton * | button(QDialogButtonBox::StandardButton b) const
QString | checkBoxText() const
QAbstractButton * | clickedButton() const
QDialogButtonBox::StandardButton | clickedStandardButton() const
QDialogButtonBox::StandardButton | defaultButton() const
QPixmap | iconPixmap() const
bool | isCheckBoxVisible() const
bool | isChecked() const
void | setCheckBoxText(const QString &)
void | setCheckBoxVisible(bool)
void | setChecked(bool s)
void | setDefaultButton(QDialogButtonBox::StandardButton s)
void | setIconPixmap(const QPixmap &p)
void | setStandardButtons(QDialogButtonBox::StandardButtons s)
void | setText(const QString &)
QDialogButtonBox::StandardButtons | standardButtons() const
QString | text() const

## Static Public Members

QMessageBox::StandardButton | dialogButtonBoxToMessageBoxButton(QDialogButtonBox::StandardButton)
QDialogButtonBox::StandardButton | doNotAskAgainQuestion(QWidget *parent, const QString &title, const QString &text, QSettings *settings, const QString &settingsSubKey, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::No, QDialogButtonBox::StandardButton acceptButton = QDialogButtonBox::Yes)
QDialogButtonBox::StandardButton | doNotShowAgainInformation(QWidget *parent, const QString &title, const QString &text, QSettings *settings, const QString &settingsSubKey, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Ok, QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::NoButton)
bool | hasSuppressedQuestions(QSettings *settings)
QDialogButtonBox::StandardButton | information(QWidget *parent, const QString &title, const QString &text, const QString &checkBoxText, bool *checkBoxSetting, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Ok, QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::NoButton)
QString | msgDoNotAskAgain()
QString | msgDoNotShowAgain()
QDialogButtonBox::StandardButton | question(QWidget *parent, const QString &title, const QString &question, const QString &checkBoxText, bool *checkBoxSetting, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::No)
void | resetAllDoNotAskAgainQuestions(QSettings *settings)

## Detailed Description

The CheckableMessageBox class implements a message box suitable for questions with a "Do not ask me again" checkbox.

Emulates the QMessageBox API with static conveniences. The message label can open external URLs.

## Property Documentation

### buttons : QDialogButtonBox::StandardButtons

Access functions:

QDialogButtonBox::StandardButtons | standardButtons() const
void | setStandardButtons(QDialogButtonBox::StandardButtons s)

### checkBoxText : QString

Access functions:

QString | checkBoxText() const
void | setCheckBoxText(const QString &)

### defaultButton : QDialogButtonBox::StandardButton

Access functions:

QDialogButtonBox::StandardButton | defaultButton() const
void | setDefaultButton(QDialogButtonBox::StandardButton s)

### iconPixmap : QPixmap

Access functions:

QPixmap | iconPixmap() const
void | setIconPixmap(const QPixmap &p)

### isChecked : bool

Access functions:

bool | isChecked() const
void | setChecked(bool s)

### text : QString

Access functions:

QString | text() const
void | setText(const QString &)

## Member Function Documentation

### CheckableMessageBox::CheckableMessageBox(QWidget *parent)

Default constructs an instance of CheckableMessageBox.

### `[virtual]` CheckableMessageBox::~CheckableMessageBox()

Destroys the instance of CheckableMessageBox. The destructor is virtual.

### QPushButton *CheckableMessageBox::addButton(const QString &text, QDialogButtonBox::ButtonRole role)

### QPushButton *CheckableMessageBox::button(QDialogButtonBox::StandardButton b) const

### QAbstractButton *CheckableMessageBox::clickedButton() const

### QDialogButtonBox::StandardButton CheckableMessageBox::clickedStandardButton() const

### `[static]` QMessageBox::StandardButton CheckableMessageBox::dialogButtonBoxToMessageBoxButton(QDialogButtonBox::StandardButton)

### `[static]` QDialogButtonBox::StandardButton CheckableMessageBox::doNotAskAgainQuestion(QWidget *parent, const QString &title, const QString &text, QSettings *settings, const QString &settingsSubKey, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::No, QDialogButtonBox::StandardButton acceptButton = QDialogButtonBox::Yes)

Shows a message box with given title and text, and a Do not ask again check box. If the user checks the check box and accepts the dialog with the acceptButton, further invocations of this function with the same settings and settingsSubKey will not show the dialog, but instantly return acceptButton.

Returns the clicked button, or QDialogButtonBox::NoButton if the user rejects the dialog with the escape key, or acceptButton if the dialog is suppressed.

### `[static]` QDialogButtonBox::StandardButton CheckableMessageBox::doNotShowAgainInformation(QWidget *parent, const QString &title, const QString &text, QSettings *settings, const QString &settingsSubKey, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Ok, QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::NoButton)

Shows a message box with given title and text, and a Do not show again check box. If the user checks the check box and quits the dialog, further invocations of this function with the same settings and settingsSubKey will not show the dialog, but instantly return.

Returns the clicked button, or QDialogButtonBox::NoButton if the user rejects the dialog with the escape key, or defaultButton if the dialog is suppressed.

### `[static]` bool CheckableMessageBox::hasSuppressedQuestions(QSettings *settings)

Returns whether any message boxes from doNotAskAgainQuestion() are suppressed in the settings.

### `[static]` QDialogButtonBox::StandardButton CheckableMessageBox::information(QWidget *parent, const QString &title, const QString &text, const QString &checkBoxText, bool *checkBoxSetting, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Ok, QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::NoButton)

### bool CheckableMessageBox::isCheckBoxVisible() const

### `[static]` QString CheckableMessageBox::msgDoNotAskAgain()

Returns the standard Do not ask again check box text.

See also doNotAskAgainQuestion().

### `[static]` QString CheckableMessageBox::msgDoNotShowAgain()

Returns the standard Do not show again check box text.

See also doNotShowAgainInformation().

### `[static]` QDialogButtonBox::StandardButton CheckableMessageBox::question(QWidget *parent, const QString &title, const QString &question, const QString &checkBoxText, bool *checkBoxSetting, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::No)

### `[static]` void CheckableMessageBox::resetAllDoNotAskAgainQuestions(QSettings *settings)

Resets all suppression settings for doNotAskAgainQuestion() found in settings, so all these message boxes are shown again.

### void CheckableMessageBox::setCheckBoxVisible(bool)

See also isCheckBoxVisible().