KMessageBox
Typedefs | |
typedef QFlags< Option > | Options |
Enumerations | |
enum | ButtonCode { Ok = 1, Cancel = 2, Yes = 3, No = 4, Continue = 5 } |
enum | DialogType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, Sorry = 7, Error = 8, QuestionYesNoCancel = 9 } |
enum | Option { Notify = 1, AllowLink = 2, Dangerous = 4, PlainCaption = 8, NoExec = 16, WindowModal = 32 } |
Functions | |
void | about (QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify) |
static void | applyOptions (QDialog *dialog, KMessageBox::Options options) |
QDialogButtonBox::StandardButton | createKMessageBox (QDialog *dialog, QDialogButtonBox *buttons, QMessageBox::Icon icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, Options options, const QString &details=QString()) |
QDialogButtonBox::StandardButton | createKMessageBox (QDialog *dialog, QDialogButtonBox *buttons, const QIcon &icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, Options options, const QString &details=QString(), QMessageBox::Icon notifyType=QMessageBox::Information) |
static QDialog * | createWIdDialog (WId parent_id) |
void | detailedError (QWidget *parent, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify) |
static void | detailedErrorInternal (QDialog *dialog, const QString &text, const QString &details, const QString &caption, Options options) |
void | detailedErrorWId (WId parent_id, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify) |
void | detailedSorry (QWidget *parent, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify) |
void | detailedSorry (QWidget *parent, const QString &text, const QString &details, const QString &caption, const KGuiItem &buttonOk, Options options=Notify) |
static void | detailedSorryInternal (QDialog *dialog, const QString &text, const QString &details, const QString &caption, const KGuiItem &buttonOk_, Options options) |
void | detailedSorryWId (WId parent_id, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify) |
void | detailedSorryWId (WId parent_id, const QString &text, const QString &details, const QString &caption, const KGuiItem &buttonOk, Options options=Notify) |
void | enableAllMessages () |
void | enableMessage (const QString &dontShowAgainName) |
void | error (QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify) |
void | errorList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), Options options=Notify) |
static void | errorListInternal (QDialog *dialog, const QString &text, const QStringList &strlist, const QString &caption, Options options) |
void | errorListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), Options options=Notify) |
void | errorWId (WId parent_id, const QString &text, const QString &caption=QString(), Options options=Notify) |
void | information (QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify) |
void | informationList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify) |
static void | informationListInternal (QDialog *dialog, const QString &text, const QStringList &strlist, const QString &caption, const QString &dontShowAgainName, Options options) |
void | informationListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify) |
void | informationWId (WId parent_id, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify) |
ButtonCode | messageBox (QWidget *parent, DialogType type, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontShowAskAgainName=QString(), Options options=Notify) |
static ButtonCode | messageBoxInternal (QDialog *dialog, DialogType type, const QString &text, const QString &caption, const KGuiItem &buttonYes, const KGuiItem &buttonNo, const KGuiItem &buttonCancel, const QString &dontShow, Options options) |
ButtonCode | messageBoxWId (WId parent_id, DialogType type, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontShowAskAgainName=QString(), Options options=Notify) |
ButtonCode | questionYesNo (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify) |
ButtonCode | questionYesNoCancel (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static ButtonCode | questionYesNoCancelInternal (QDialog *dialog, const QString &text, const QString &caption, const KGuiItem &buttonYes_, const KGuiItem &buttonNo_, const KGuiItem &buttonCancel_, const QString &dontAskAgainName, Options options) |
ButtonCode | questionYesNoCancelWId (WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
ButtonCode | questionYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static ButtonCode | questionYesNoListInternal (QDialog *dialog, const QString &text, const QStringList &strlist, const QString &caption, const KGuiItem &buttonYes_, const KGuiItem &buttonNo_, const QString &dontAskAgainName, Options options) |
ButtonCode | questionYesNoListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify) |
ButtonCode | questionYesNoWId (WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify) |
void | saveDontShowAgainContinue (const QString &dontShowAgainName) |
void | saveDontShowAgainYesNo (const QString &dontShowAgainName, ButtonCode result) |
void | setDontShowAgainConfig (KConfig *cfg) |
KWIDGETSADDONS_EXPORT void | setDontShowAgainInterface (KMessageBoxDontAskAgainInterface *dontAskAgainInterface) |
KWIDGETSADDONS_EXPORT void | setDontShowAskAgainConfig (KConfig *cfg) |
static void | setMainWindow (QWidget *subWidget, WId mainWindowId) |
KWIDGETSADDONS_EXPORT void | setNotifyInterface (KMessageBoxNotifyInterface *notifyInterface) |
bool | shouldBeShownContinue (const QString &dontShowAgainName) |
bool | shouldBeShownYesNo (const QString &dontShowAgainName, ButtonCode &result) |
void | sorry (QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify) |
void | sorry (QWidget *parent, const QString &text, const QString &caption, const KGuiItem &buttonOk, Options options=Notify) |
static void | sorryInternal (QDialog *dialog, const QString &text, const QString &caption, const KGuiItem &buttonOk_, Options options) |
KWIDGETSADDONS_EXPORT void | sorryWId (WId parent_id, const QString &text, const QString &caption, const KGuiItem &buttonOk, Options options=Notify) |
void | sorryWId (WId parent_id, const QString &text, const QString &caption=QString(), Options options=Notify) |
ButtonCode | warningContinueCancel (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
ButtonCode | warningContinueCancelDetailed (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify, const QString &details=QString()) |
ButtonCode | warningContinueCancelList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static ButtonCode | warningContinueCancelListInternal (QDialog *dialog, const QString &text, const QStringList &strlist, const QString &caption, const KGuiItem &buttonContinue_, const KGuiItem &buttonCancel_, const QString &dontAskAgainName, Options options, const QString &details) |
ButtonCode | warningContinueCancelListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
ButtonCode | warningContinueCancelWId (WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
ButtonCode | warningYesNo (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous)) |
ButtonCode | warningYesNoCancel (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
ButtonCode | warningYesNoCancelList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static ButtonCode | warningYesNoCancelListInternal (QDialog *dialog, const QString &text, const QStringList &strlist, const QString &caption, const KGuiItem &buttonYes_, const KGuiItem &buttonNo_, const KGuiItem &buttonCancel_, const QString &dontAskAgainName, Options options) |
ButtonCode | warningYesNoCancelListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
ButtonCode | warningYesNoCancelWId (WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
ButtonCode | warningYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous)) |
static ButtonCode | warningYesNoListInternal (QDialog *dialog, const QString &text, const QStringList &strlist, const QString &caption, const KGuiItem &buttonYes_, const KGuiItem &buttonNo_, const QString &dontAskAgainName, Options options) |
ButtonCode | warningYesNoListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous)) |
ButtonCode | warningYesNoWId (WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous)) |
Variables | |
QDialogButtonBox::StandardButton KWIDGETSADDONS_EXPORT(* | KMessageBox_exec_hook )(QDialog *) = nullptr |
Detailed Description
Easy message dialog box.
Provides convenience functions for some i18n'ed standard dialogs, as well as audible notification via KNotification
The text in message boxes is wrapped automatically. The text may either be plaintext or richtext. If the text is plaintext, a newline-character may be used to indicate the end of a paragraph.

Typedef Documentation
typedef QFlags< Option > KMessageBox::Options |
Stores a combination of Option values.
Definition at line 83 of file kmessagebox.h.
Enumeration Type Documentation
Button types.
Definition at line 48 of file kmessagebox.h.
enum KMessageBox::Option |
- See also
- Options
Enumerator | |
---|---|
Notify |
Emit a KNotify event. |
AllowLink |
The message may contain links. |
Dangerous |
The action to be confirmed by the dialog is a potentially destructive one. The default button will be set to Cancel or No, depending on which is available. |
PlainCaption |
Do not use KApplication::makeStdCaption() |
NoExec |
Do not call exec() in createKMessageBox() |
WindowModal |
The window is to be modal relative to its parent. By default, it is application modal. |
Definition at line 71 of file kmessagebox.h.
Function Documentation
KWIDGETSADDONS_EXPORT void KMessageBox::about | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
Display an "About" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("About \<appname\>"). options see Options
Your program wants to show some general information about the application like the authors's names and email addresses.
The default button is "&OK".
- Note
- The OK button will always have the i18n'ed text '&OK'.
Definition at line 934 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT QDialogButtonBox::StandardButton KMessageBox::createKMessageBox | ( | QDialog * | dialog, |
QDialogButtonBox * | buttons, | ||
QMessageBox::Icon | icon, | ||
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | ask, | ||
bool * | checkboxReturn, | ||
Options | options, | ||
const QString & | details = QString() |
||
) |
Create content and layout of a standard dialog.
- Parameters
-
dialog The parent dialog base buttons a QDialogButtonBox instance. This function will take care of connecting to it. icon Which predefined icon the message box shall show. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox ask The text of the checkbox. If empty none will be shown. checkboxReturn The result of the checkbox. If it's initially true then the checkbox will be checked by default. May be a null pointer. Incompatible with NoExec. options see Options details Detailed message string.
- Returns
- A QDialogButtonBox::StandardButton button code, not a KMessageBox button code, based on the buttonmask given to the constructor of the
dialog
(ie. will return QDialogButtonBox::Yes instead of KMessageBox::Yes). Will return QDialogButtonBox::NoButton if the message box is queued for display instead of exec()ed immediately or if the option NoExec is set.
- Note
- Unless NoExec is used, the
dialog
that is passed in is deleted by this function. Do not delete it yourself.
Definition at line 153 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT QDialogButtonBox::StandardButton KMessageBox::createKMessageBox | ( | QDialog * | dialog, |
QDialogButtonBox * | buttons, | ||
const QIcon & | icon, | ||
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | ask, | ||
bool * | checkboxReturn, | ||
Options | options, | ||
const QString & | details = QString() , |
||
QMessageBox::Icon | notifyType = QMessageBox::Information |
||
) |
Create content and layout of a standard dialog.
- Parameters
-
dialog The parent dialog base buttons a QDialogButtonBox instance. This function will take care of connecting to it. icon A QPixmap containing the icon to be displayed in the dialog next to the text. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox ask The text of the checkbox. If empty none will be shown. checkboxReturn The result of the checkbox. If it's initially true then the checkbox will be checked by default. May be a null pointer. Incompatible with NoExec. options see Options details Detailed message string. notifyType The type of notification to send when this message is presentend.
- Returns
- A QDialogButtonBox::StandardButton button code, not a KMessageBox button code, based on the buttonmask given to the constructor of the
dialog
(ie. will return QDialogButtonBox::Yes instead of KMessageBox::Yes). Will return QDialogButtonBox::NoButton if the message box is queued for display instead of exec()ed immediately or if the option NoExec is set.
- Note
- Unless NoExec is used, the
dialog
that is passed in is deleted by this function. Do not delete it yourself.
Definition at line 181 of file kmessagebox.cpp.
|
static |
Create a QDialog whose parent is a foreign window.
Definition at line 109 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::detailedError | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | details, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
Displays an "Error" dialog with a "Details >>" button.
- Parameters
-
parent Parent widget. text Message string. details Detailed message string. caption Message box title. The application name is added to the title. The default title is i18n("Error"). options see Options
Your program messed up and now it's time to inform the user. To be used for important things like "Sorry, I deleted your hard disk."
The details
message can contain additional information about the problem and can be shown on request to advanced/interested users.
If your program detects the action specified by the user is somehow not allowed, this should never be reported with error(). Use sorry() instead to explain to the user that this action is not allowed.
The default button is "&OK". Pressing "Esc" selects the OK-button.
- Note
- The OK button will always have the i18n'ed text '&OK'.
Definition at line 818 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::detailedErrorWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | details, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1121 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::detailedSorry | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | details, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
Displays a "Sorry" dialog with a "Details >>" button.
- Parameters
-
parent Parent widget. text Message string. details Detailed message string. caption Message box title. The application name is added to the title. The default title is i18n("Sorry"). options see Options
Either your program messed up and asks for understanding or your user did something stupid.
To be used for small problems like "Sorry, I can't find the file you specified."
And then details
can contain something like "foobar.txt was not found in any of the following directories: /usr/bin,/usr/local/bin,/usr/sbin"
The default button is "&OK". Pressing "Esc" selects the OK-button.
- Note
- The OK button will always have the i18n'ed text '&OK'. See the overload with a KGuiItem argument to change that.
Definition at line 879 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::detailedSorry | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | details, | ||
const QString & | caption, | ||
const KGuiItem & | buttonOk, | ||
Options | options = Notify |
||
) |
Displays a "Sorry" dialog with a "Details >>" button.
- Parameters
-
parent Parent widget. text Message string. details Detailed message string. caption Message box title. The application name is added to the title. The default title is i18n("Sorry"). buttonOk The text for the only button. The default is KStandardGuiItem::ok(). options see Options
Either your program messed up and asks for understanding or your user did something stupid.
To be used for small problems like "Sorry, I can't find the file you specified."
And then details
can contain something like "foobar.txt was not found in any of the following directories: /usr/bin,/usr/local/bin,/usr/sbin"
There is only one button, therefore it's the default button, and pressing "Esc" selects it as well.
- Since
- 5.63
Definition at line 886 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::detailedSorryWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | details, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1147 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::detailedSorryWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | details, | ||
const QString & | caption, | ||
const KGuiItem & | buttonOk, | ||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
- Since
- 5.63
Definition at line 1154 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::enableAllMessages | ( | ) |
Enable all messages which have been turned off with the dontShowAgainName
feature.
Definition at line 427 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::enableMessage | ( | const QString & | dontShowAgainName | ) |
Re-enable a specific dontShowAgainName
messages that had previously been turned off.
Definition at line 432 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::error | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
Display an "Error" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Error"). options see Options
Your program messed up and now it's time to inform the user. To be used for important things like "Sorry, I deleted your hard disk."
If your program detects the action specified by the user is somehow not allowed, this should never be reported with error(). Use sorry() instead to explain to the user that this action is not allowed.
The default button is "&OK". Pressing "Esc" selects the OK-button.
- Note
- The OK button will always have the i18n'ed text '&OK'.
Definition at line 776 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::errorList | ( | QWidget * | parent, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
Display an "Error" dialog with a listbox.
- Parameters
-
parent Parent widget. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as error(). caption Message box title. The application name is added to the title. The default title is i18n("Error"). options see Options
Your program messed up and now it's time to inform the user. To be used for important things like "Sorry, I deleted your hard disk."
If your program detects the action specified by the user is somehow not allowed, this should never be reported with error(). Use sorry() instead to explain to the user that this action is not allowed.
The default button is "&OK". Pressing "Esc" selects the OK-button.
- Note
- The OK button will always have the i18n'ed text '&OK'.
Definition at line 796 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::errorListWId | ( | WId | parent_id, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1115 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::errorWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1109 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::information | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const QString & | dontShowAgainName = QString() , |
||
Options | options = Notify |
||
) |
Display an "Information" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Information"). dontShowAgainName If provided, a checkbox is added with which further notifications can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. options see Options
Your program wants to tell the user something. To be used for things like: "Your bookmarks have been rearranged."
The default button is "&OK". Pressing "Esc" selects the OK-button.
- Note
- The OK button will always have the i18n'ed text '&OK'.
Definition at line 895 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::informationList | ( | QWidget * | parent, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const QString & | dontShowAgainName = QString() , |
||
Options | options = Notify |
||
) |
Display an "Information" dialog with a listbox.
- Parameters
-
parent Parent widget. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as information. caption Message box title. The application name is added to the title. The default title is i18n("Information"). dontShowAgainName If provided, a checkbox is added with which further notifications can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. options see Options
Your program wants to tell the user something. To be used for things like: "The following bookmarks have been rearranged:"
The default button is "&OK". Pressing "Esc" selects the OK-button.
- Note
- The OK button will always have the i18n'ed text '&OK'.
Definition at line 928 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::informationListWId | ( | WId | parent_id, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const QString & | dontShowAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1169 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::informationWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const QString & | dontShowAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1163 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::messageBox | ( | QWidget * | parent, |
DialogType | type, | ||
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontShowAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
Alternate method to show a messagebox:
- Parameters
-
parent Parent widget. type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel... text Message string. caption Message box title. buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). buttonCancel The text for the third button. The default is KStandardGuiItem::cancel(). dontShowAskAgainName If provided, a checkbox is added with which further questions/information can be turned off. If turned off all questions will be automatically answered with the last answer (either Yes or No), if the message box needs an answer. The string is used to lookup and store the setting in the applications config file. options see Options Note: for ContinueCancel, buttonYes is the continue button and buttonNo is unused. and for Information, none is used.
- Returns
- a button code, as defined in KMessageBox.
Definition at line 992 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::messageBoxWId | ( | WId | parent_id, |
DialogType | type, | ||
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontShowAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1175 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::questionYesNo | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
Display a simple "question" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Question"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Option
- Returns
- 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
To be used for questions like "Do you have a printer?"
The default button is "Yes". Pressing "Esc" selects "No".
Definition at line 382 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::questionYesNoCancel | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
Display a simple "question" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Question"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). buttonCancel The text for the third button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns
- 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
To be used for questions like "Do you want to discard the message or save it for later?",
The default button is "Yes". Pressing "Esc" selects "Cancel".
Definition at line 545 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::questionYesNoCancelWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1024 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::questionYesNoList | ( | QWidget * | parent, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
Display a "question" dialog with a listbox to show information to the user.
- Parameters
-
parent Parent widget. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionYesNo. caption Message box title. The application name is added to the title. The default title is i18n("Question"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns
- 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
To be used for questions like "Do you really want to delete these files?" And show the user exactly which files are going to be deleted in case he presses "Yes"
The default button is "Yes". Pressing "Esc" selects "No".
Definition at line 482 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::questionYesNoListWId | ( | WId | parent_id, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1012 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::questionYesNoWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1001 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::saveDontShowAgainContinue | ( | const QString & | dontShowAgainName | ) |
Save the fact that the continue/cancel message box should not be shown again.
- Parameters
-
dontShowAgainName the name that identify the message box. If empty, this method does nothing.
Definition at line 419 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::saveDontShowAgainYesNo | ( | const QString & | dontShowAgainName, |
ButtonCode | result | ||
) |
Save the fact that the yes/no message box should not be shown again.
- Parameters
-
dontShowAgainName the name that identify the message box. If empty, this method does nothing. result the value (Yes or No) that should be used as the result for the message box.
Definition at line 410 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::setDontShowAgainConfig | ( | KConfig * | cfg | ) |
Use cfg
for all settings related to the dontShowAgainName feature.
If cfg
is 0 (default) KGlobal::config() will be used.
Definition at line 437 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::setDontShowAgainInterface | ( | KMessageBoxDontAskAgainInterface * | dontAskAgainInterface | ) |
Use dontAskAgainInterface
for all settings related to the dontShowAgain feature.
This method does not take ownership of dontAskAgainInterface
.
- Since
- 5.0
|
inline |
- Deprecated:
- since 5.0, use setDontShowAgainConfig()
Definition at line 835 of file kmessagebox.h.
KWIDGETSADDONS_EXPORT void KMessageBox::setNotifyInterface | ( | KMessageBoxNotifyInterface * | notifyInterface | ) |
Use notifyInterface
to send notifications.
This method does not take ownership of notifyInterface
.
- Since
- 5.0
KWIDGETSADDONS_EXPORT bool KMessageBox::shouldBeShownContinue | ( | const QString & | dontShowAgainName | ) |
- Returns
- true if the corresponding continue/cancel message box should be shown.
- Parameters
-
dontShowAgainName the name that identify the message box. If empty, true is always returned.
Definition at line 402 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT bool KMessageBox::shouldBeShownYesNo | ( | const QString & | dontShowAgainName, |
ButtonCode & | result | ||
) |
- Returns
- true if the corresponding yes/no message box should be shown.
- Parameters
-
dontShowAgainName the name that identify the message box. If empty, true is always returned. result is set to the result (Yes or No) that was chosen the last time the message box was shown. Only meaningful, if the message box should not be shown.
Definition at line 393 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::sorry | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
Display a "Sorry" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Sorry"). options see OptionsType
Either your program messed up and asks for understanding or your user did something stupid.
To be used for small problems like "Sorry, I can't find the file you specified."
The default button is "&OK". Pressing "Esc" selects the OK-button.
- Note
- The OK button will always have the i18n'ed text '&OK'. See the overload with a KGuiItem argument to change that.
Definition at line 845 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::sorry | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption, | ||
const KGuiItem & | buttonOk, | ||
Options | options = Notify |
||
) |
Display a "Sorry" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Sorry"). buttonOk The text for the only button. The default is KStandardGuiItem::ok(). options see OptionsType
Either your program messed up and asks for understanding or your user did something stupid.
To be used for small problems like "Sorry, I can't find the file you specified."
The default button is "&OK". Pressing "Esc" selects the OK-button.
There is only one button, therefore it's the default button, and pressing "Esc" selects it as well.
- Since
- 5.63
Definition at line 851 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT void KMessageBox::sorryWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | caption, | ||
const KGuiItem & | buttonOk, | ||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
- Since
- 5.63
KWIDGETSADDONS_EXPORT void KMessageBox::sorryWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1128 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningContinueCancel | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonContinue = KStandardGuiItem::cont() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
Display a "warning" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonContinue The text for the first button. The default is KStandardGuiItem::cont(). buttonCancel The text for the second button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns
Continue
is returned if the Continue-button is pressed.Cancel
is returned if the Cancel-button is pressed.
To be used for questions like "You are about to Print. Are you sure?" the continueButton should then be labeled "Print".
The default button is buttonContinue. Pressing "Esc" selects "Cancel".
Definition at line 621 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningContinueCancelDetailed | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonContinue = KStandardGuiItem::cont() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify , |
||
const QString & | details = QString() |
||
) |
Display a "warning" dialog with a collapsible "Details" section.
- Since
- 5.61
Definition at line 688 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningContinueCancelList | ( | QWidget * | parent, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonContinue = KStandardGuiItem::cont() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
Display a "warning" dialog with a listbox to show information to the user.
- Parameters
-
parent Parent widget. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningContinueCancel. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonContinue The text for the first button. The default is KStandardGuiItem::cont(). buttonCancel The text for the second button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns
Continue
is returned if the Continue-button is pressed.Cancel
is returned if the Cancel-button is pressed.
To be used for questions like "You are about to Print. Are you sure?" the continueButton should then be labeled "Print".
The default button is buttonContinue. Pressing "Esc" selects "Cancel".
Definition at line 675 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningContinueCancelListWId | ( | WId | parent_id, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonContinue = KStandardGuiItem::cont() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1072 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningContinueCancelWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonContinue = KStandardGuiItem::cont() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1060 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningYesNo | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Options(Notify|Dangerous) |
||
) |
Display a "warning" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns
Yes
is returned if the Yes-button is pressed.No
is returned if the No-button is pressed.
To be used for questions "Shall I update your configuration?" The text should explain the implication of both options.
The default button is "No". Pressing "Esc" selects "No".
Definition at line 558 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningYesNoCancel | ( | QWidget * | parent, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
Display a Yes/No/Cancel "warning" dialog.
- Parameters
-
parent Parent widget. text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). buttonCancel The text for the third button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further questions can be turned off. If turned off all questions will be automatically answered with the last answer (either Yes or No). The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns
Yes
is returned if the Yes-button is pressed.No
is returned if the No-button is pressed.Cancel
is retunred if the Cancel- button is pressed.
To be used for questions "Do you want to save your changes?" The text should explain the implication of choosing 'No'.
The default button is "Yes". Pressing "Esc" selects "Cancel"
Definition at line 701 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningYesNoCancelList | ( | QWidget * | parent, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
Display a Yes/No/Cancel "warning" dialog with a listbox to show information to the user.
- Parameters
-
parent Parent widget. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningYesNoCancel. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). buttonCancel The text for the third button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further questions can be turned off. If turned off all questions will be automatically answered with the last answer (either Yes or No). The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns
Yes
is returned if the Yes-button is pressed.No
is returned if the No-button is pressed.Cancel
is retunred if the Cancel- button is pressed.
To be used for questions "Do you want to save your changes?" The text should explain the implication of choosing 'No'.
The default button is "Yes". Pressing "Esc" selects "Cancel"
Definition at line 763 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningYesNoCancelListWId | ( | WId | parent_id, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1096 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningYesNoCancelWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Notify |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1084 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningYesNoList | ( | QWidget * | parent, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Options(Notify|Dangerous) |
||
) |
Display a "warning" dialog with a listbox to show information to the user.
- Parameters
-
parent Parent widget. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionYesNo. caption Message box title. The application name is added to the title. The default title is i18n("Question"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns
- 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
To be used for questions like "Do you really want to delete these files?" And show the user exactly which files are going to be deleted in case he presses "Yes"
The default button is "No". Pressing "Esc" selects "No".
Definition at line 609 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningYesNoListWId | ( | WId | parent_id, |
const QString & | text, | ||
const QStringList & | strlist, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Options(Notify|Dangerous) |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1048 of file kmessagebox.cpp.
KWIDGETSADDONS_EXPORT ButtonCode KMessageBox::warningYesNoWId | ( | WId | parent_id, |
const QString & | text, | ||
const QString & | caption = QString() , |
||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
||
const QString & | dontAskAgainName = QString() , |
||
Options | options = Options(Notify|Dangerous) |
||
) |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1037 of file kmessagebox.cpp.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 16 2021 22:45:59 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.