The CheckableMessageBox class implements a message box suitable for questions with a "Do not ask me again" checkbox. More...
#include <checkablemessagebox.h>
Public Member Functions | |
CheckableMessageBox (QWidget *parent) | |
virtual | ~CheckableMessageBox () Q_DECL_OVERRIDE |
QString | text () const |
void | setText (const QString &) |
bool | isChecked () const |
void | setChecked (bool s) |
QString | checkBoxText () const |
void | setCheckBoxText (const QString &) |
bool | isCheckBoxVisible () const |
void | setCheckBoxVisible (bool) |
QDialogButtonBox::StandardButtons | standardButtons () const |
void | setStandardButtons (QDialogButtonBox::StandardButtons s) |
QPushButton * | button (QDialogButtonBox::StandardButton b) const |
QPushButton * | addButton (const QString &text, QDialogButtonBox::ButtonRole role) |
QDialogButtonBox::StandardButton | defaultButton () const |
void | setDefaultButton (QDialogButtonBox::StandardButton s) |
void | setIconPixmap (const QPixmap &p) |
QAbstractButton * | clickedButton () const |
QDialogButtonBox::StandardButton | clickedStandardButton () const |
Static Public Member Functions | |
static 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) |
static 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) |
static 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) |
Shows a message box with given title and text, and a \gui {Do not ask again} check box. More... | |
static 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) |
Shows a message box with given title and text, and a \gui {Do not show again} check box. More... | |
static QMessageBox::StandardButton | dialogButtonBoxToMessageBoxButton (QDialogButtonBox::StandardButton) |
static void | resetAllDoNotAskAgainQuestions (QSettings *settings) |
Resets all suppression settings for doNotAskAgainQuestion() found in settings, so all these message boxes are shown again. More... | |
static bool | hasSuppressedQuestions (QSettings *settings) |
Returns whether any message boxes from doNotAskAgainQuestion() are suppressed in the settings. More... | |
static QString | msgDoNotAskAgain () |
Returns the standard \gui {Do not ask again} check box text. More... | |
static QString | msgDoNotShowAgain () |
Returns the standard \gui {Do not show again} check box text. More... | |
Properties | |
QString | text |
bool | isChecked |
QString | checkBoxText |
QDialogButtonBox::StandardButtons | buttons |
QDialogButtonBox::StandardButton | defaultButton |
Private Types | |
enum | DoNotAskAgainType { Question , Information } |
Private Slots | |
void | slotClicked (QAbstractButton *b) |
Static Private Member Functions | |
static bool | askAgain (QSettings *settings, const QString &settingsSubKey) |
static void | initDoNotAskAgainMessageBox (CheckableMessageBox &messageBox, const QString &title, const QString &text, QDialogButtonBox::StandardButtons buttons, QDialogButtonBox::StandardButton defaultButton, DoNotAskAgainType type) |
static void | doNotAskAgain (QSettings *settings, const QString &settingsSubKey) |
Private Attributes | |
CheckableMessageBoxPrivate * | d |
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.
Definition at line 39 of file checkablemessagebox.h.
|
private |
Enumerator | |
---|---|
Question | |
Information |
Definition at line 131 of file checkablemessagebox.h.
|
explicit |
Definition at line 111 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::buttonBox, d, and slotClicked().
|
virtual |
Definition at line 122 of file checkablemessagebox.cpp.
References d.
QPushButton * Utils::CheckableMessageBox::addButton | ( | const QString & | text, |
QDialogButtonBox::ButtonRole | role | ||
) |
Definition at line 216 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::buttonBox, d, and text.
|
staticprivate |
Definition at line 293 of file checkablemessagebox.cpp.
References kDoNotAskAgainKey.
Referenced by doNotAskAgainQuestion(), and doNotShowAgainInformation().
QPushButton * Utils::CheckableMessageBox::button | ( | QDialogButtonBox::StandardButton | b | ) | const |
Definition at line 211 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::buttonBox, and d.
QString Utils::CheckableMessageBox::checkBoxText | ( | ) | const |
Definition at line 180 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::checkBox, and d.
QAbstractButton * Utils::CheckableMessageBox::clickedButton | ( | ) | const |
Definition at line 132 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::clickedButton, and d.
QDialogButtonBox::StandardButton Utils::CheckableMessageBox::clickedStandardButton | ( | ) | const |
Definition at line 137 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::buttonBox, Utils::CheckableMessageBoxPrivate::clickedButton, and d.
Referenced by doNotAskAgainQuestion(), doNotShowAgainInformation(), information(), and question().
QDialogButtonBox::StandardButton Utils::CheckableMessageBox::defaultButton | ( | ) | const |
Definition at line 221 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::buttonBox, and d.
|
static |
Definition at line 288 of file checkablemessagebox.cpp.
|
staticprivate |
Definition at line 327 of file checkablemessagebox.cpp.
References kDoNotAskAgainKey.
Referenced by doNotAskAgainQuestion(), and doNotShowAgainInformation().
|
static |
Shows a message box with given title and text, and a \gui {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.
Definition at line 350 of file checkablemessagebox.cpp.
References askAgain(), buttons, clickedStandardButton(), defaultButton, doNotAskAgain(), initDoNotAskAgainMessageBox(), isChecked, Question, and text.
|
static |
Shows a message box with given title and text, and a \gui {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.
Definition at line 384 of file checkablemessagebox.cpp.
References askAgain(), buttons, clickedStandardButton(), defaultButton, doNotAskAgain(), Information, initDoNotAskAgainMessageBox(), isChecked, and text.
|
static |
Returns whether any message boxes from doNotAskAgainQuestion() are suppressed in the settings.
Definition at line 425 of file checkablemessagebox.cpp.
References kDoNotAskAgainKey.
|
static |
Definition at line 266 of file checkablemessagebox.cpp.
References buttons, checkBoxText, clickedStandardButton(), defaultButton, isChecked, setCheckBoxText(), setChecked(), setDefaultButton(), setIconPixmap(), setStandardButtons(), setText(), and text.
|
staticprivate |
Definition at line 309 of file checkablemessagebox.cpp.
References buttons, defaultButton, Information, msgDoNotAskAgain(), msgDoNotShowAgain(), setCheckBoxText(), setCheckBoxVisible(), setChecked(), setDefaultButton(), setIconPixmap(), setStandardButtons(), setText(), and text.
Referenced by doNotAskAgainQuestion(), and doNotShowAgainInformation().
bool Utils::CheckableMessageBox::isCheckBoxVisible | ( | ) | const |
Definition at line 191 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::checkBox, and d.
bool Utils::CheckableMessageBox::isChecked | ( | ) | const |
Definition at line 170 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::checkBox, and d.
|
static |
Returns the standard \gui {Do not ask again} check box text.
Definition at line 446 of file checkablemessagebox.cpp.
References translate.
Referenced by initDoNotAskAgainMessageBox().
|
static |
Returns the standard \gui {Do not show again} check box text.
Definition at line 455 of file checkablemessagebox.cpp.
References translate.
Referenced by initDoNotAskAgainMessageBox().
|
static |
Definition at line 244 of file checkablemessagebox.cpp.
References buttons, checkBoxText, clickedStandardButton(), defaultButton, isChecked, setCheckBoxText(), setChecked(), setDefaultButton(), setIconPixmap(), setStandardButtons(), and setText().
|
static |
Resets all suppression settings for doNotAskAgainQuestion() found in settings, so all these message boxes are shown again.
Definition at line 412 of file checkablemessagebox.cpp.
References kDoNotAskAgainKey.
void Utils::CheckableMessageBox::setCheckBoxText | ( | const QString & | t | ) |
Definition at line 185 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::checkBox, and d.
Referenced by information(), initDoNotAskAgainMessageBox(), and question().
void Utils::CheckableMessageBox::setCheckBoxVisible | ( | bool | v | ) |
Definition at line 196 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::checkBox, and d.
Referenced by initDoNotAskAgainMessageBox().
void Utils::CheckableMessageBox::setChecked | ( | bool | s | ) |
Definition at line 175 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::checkBox, and d.
Referenced by information(), initDoNotAskAgainMessageBox(), and question().
void Utils::CheckableMessageBox::setDefaultButton | ( | QDialogButtonBox::StandardButton | s | ) |
Definition at line 234 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::buttonBox, and d.
Referenced by VAbstractTool::ConfirmDeletion(), VAbstractMainWindow::ContinueFormatRewrite(), information(), initDoNotAskAgainMessageBox(), and question().
void Utils::CheckableMessageBox::setIconPixmap | ( | const QPixmap & | p | ) |
Definition at line 164 of file checkablemessagebox.cpp.
References d, and Utils::CheckableMessageBoxPrivate::pixmapLabel.
Referenced by VAbstractTool::ConfirmDeletion(), VAbstractMainWindow::ContinueFormatRewrite(), information(), initDoNotAskAgainMessageBox(), and question().
void Utils::CheckableMessageBox::setStandardButtons | ( | QDialogButtonBox::StandardButtons | s | ) |
Definition at line 206 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::buttonBox, and d.
Referenced by VAbstractTool::ConfirmDeletion(), VAbstractMainWindow::ContinueFormatRewrite(), information(), initDoNotAskAgainMessageBox(), and question().
void Utils::CheckableMessageBox::setText | ( | const QString & | t | ) |
Definition at line 151 of file checkablemessagebox.cpp.
References d, and Utils::CheckableMessageBoxPrivate::messageLabel.
Referenced by VAbstractTool::ConfirmDeletion(), VAbstractMainWindow::ContinueFormatRewrite(), information(), initDoNotAskAgainMessageBox(), and question().
|
privateslot |
Definition at line 127 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::clickedButton, and d.
Referenced by CheckableMessageBox().
QDialogButtonBox::StandardButtons Utils::CheckableMessageBox::standardButtons | ( | ) | const |
Definition at line 201 of file checkablemessagebox.cpp.
References Utils::CheckableMessageBoxPrivate::buttonBox, and d.
QString Utils::CheckableMessageBox::text | ( | ) | const |
Definition at line 146 of file checkablemessagebox.cpp.
References d, and Utils::CheckableMessageBoxPrivate::messageLabel.
|
private |
Definition at line 130 of file checkablemessagebox.h.
Referenced by addButton(), button(), CheckableMessageBox(), checkBoxText(), clickedButton(), clickedStandardButton(), defaultButton(), isCheckBoxVisible(), isChecked(), setCheckBoxText(), setCheckBoxVisible(), setChecked(), setDefaultButton(), setIconPixmap(), setStandardButtons(), setText(), slotClicked(), standardButtons(), text(), and ~CheckableMessageBox().
|
readwrite |
Definition at line 1 of file checkablemessagebox.h.
Referenced by doNotAskAgainQuestion(), doNotShowAgainInformation(), information(), initDoNotAskAgainMessageBox(), and question().
|
readwrite |
Definition at line 1 of file checkablemessagebox.h.
Referenced by information(), and question().
|
readwrite |
Definition at line 1 of file checkablemessagebox.h.
Referenced by doNotAskAgainQuestion(), doNotShowAgainInformation(), information(), initDoNotAskAgainMessageBox(), and question().
|
readwrite |
Definition at line 1 of file checkablemessagebox.h.
Referenced by VAbstractTool::ConfirmDeletion(), VAbstractMainWindow::ContinueFormatRewrite(), doNotAskAgainQuestion(), doNotShowAgainInformation(), information(), and question().
|
readwrite |
Definition at line 1 of file checkablemessagebox.h.
Referenced by addButton(), doNotAskAgainQuestion(), doNotShowAgainInformation(), information(), and initDoNotAskAgainMessageBox().