CheckableMessageBox Class

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>
Inherits: QDialog

Public Functions

QString checkBoxText() const
QDialogButtonBox::StandardButton defaultButton() const
QMessageBox::Icon icon() const
bool isChecked() const
void setCheckBoxText(const QString &)
void setChecked(bool s)
void setDefaultButton(QDialogButtonBox::StandardButton s)
void setIcon(QMessageBox::Icon icon)
void setStandardButtons(QDialogButtonBox::StandardButtons s)
void setText(const QString &)
QDialogButtonBox::StandardButtons standardButtons() const
QString text() const

Static Public Members

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)
QString msgDoNotAskAgain()
QString msgDoNotShowAgain()
void resetAllDoNotAskAgainQuestions(QSettings *settings)

Detailed Description

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

Member Function Documentation

[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] 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] void CheckableMessageBox::resetAllDoNotAskAgainQuestions(QSettings *settings)

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

© 2023 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. Qt and 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.