Message dialog box for SUIT-based application. More...
#include <SUIT_MessageBox.h>
Classes | |
class | ButtonInfo |
Public Member Functions | |
SUIT_MessageBox (QWidget *=0) | |
Constructor. More... | |
SUIT_MessageBox (Icon, const QString &, const QString &, StandardButtons buttons=NoButton, QWidget *=0, Qt::WindowFlags=Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint) | |
Constructor. More... | |
~SUIT_MessageBox () | |
Destructor. More... | |
QString | buttonText (StandardButton) const |
Get the standard button text. More... | |
void | setButtonText (StandardButton, const QString &) |
Set the standard button text. More... | |
Static Public Member Functions | |
static StandardButton | critical (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton) |
Show critical message box with specified standard buttons. More... | |
static StandardButton | warning (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton) |
static StandardButton | information (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton) |
Show information message box with specified standard buttons. More... | |
static StandardButton | question (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton) |
Show question message box with specified standard buttons. More... | |
static int | critical (QWidget *parent, const QString &title, const QString &text, const QString &button) |
Show critical message box with one custom button. More... | |
static int | warning (QWidget *parent, const QString &title, const QString &text, const QString &button) |
Show warning message box with one custom button. More... | |
static int | information (QWidget *parent, const QString &title, const QString &text, const QString &button) |
Show information message box with one custom button. More... | |
static int | question (QWidget *parent, const QString &title, const QString &text, const QString &button) |
Show question message box with one custom button. More... | |
static int | critical (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const int defaultButton=-1, const int escapeButton=-1) |
Show critical message box with two custom buttons. More... | |
static int | warning (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const int defaultButton=-1, const int escapeButton=-1) |
Show warning message box with two custom buttons. More... | |
static int | information (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const int defaultButton=-1, const int escapeButton=-1) |
Show information message box with two custom buttons. More... | |
static int | question (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const int defaultButton=-1, const int escapeButton=-1) |
Show question message box with two custom buttons. More... | |
static int | critical (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const QString &button3, const int defaultButton=-1, const int escapeButton=-1) |
Show critical message box with three custom buttons. More... | |
static int | warning (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const QString &button3, const int defaultButton=-1, const int escapeButton=-1) |
Show warning message box with three custom buttons. More... | |
static int | information (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const QString &button3, const int defaultButton=-1, const int escapeButton=-1) |
Show information message box with three custom buttons. More... | |
static int | question (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const QString &button3, const int defaultButton=-1, const int escapeButton=-1) |
Show question message box with three custom buttons. More... | |
static int | critical (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const QString &button3, const QString &button4, const int defaultButton=-1, const int escapeButton=-1) |
Show critical message box with four custom buttons. More... | |
static int | warning (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const QString &button3, const QString &button4, const int defaultButton=-1, const int escapeButton=-1) |
Show warning message box with four custom buttons. More... | |
static int | information (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const QString &button3, const QString &button4, const int defaultButton=-1, const int escapeButton=-1) |
Show information message box with four custom buttons. More... | |
static int | question (QWidget *parent, const QString &title, const QString &text, const QString &button1, const QString &button2, const QString &button3, const QString &button4, const int defaultButton=-1, const int escapeButton=-1) |
Show question message box with four custom buttons. More... | |
static int | critical (QWidget *parent, const QString &title, const QString &text, const QStringList &buttons, const int defaultButton=-1, const int escapeButton=-1) |
Show critical message box with arbitrary number of user-specified buttons. More... | |
static int | warning (QWidget *parent, const QString &title, const QString &text, const QStringList &buttons, const int defaultButton=-1, const int escapeButton=-1) |
Show warning message box with arbitrary number of user-specified buttons. More... | |
static int | information (QWidget *parent, const QString &title, const QString &text, const QStringList &buttons, const int defaultButton=-1, const int escapeButton=-1) |
Show information message box with arbitrary number of user-specified buttons. More... | |
static int | question (QWidget *parent, const QString &title, const QString &text, const QStringList &buttons, const int defaultButton=-1, const int escapeButton=-1) |
Show question message box with arbitrary number of user-specified buttons. More... | |
static int | critical (QWidget *parent, const QString &title, const QString &text, const int defaultButton, const int escapeButton, char *,...) |
Show critical message box with arbitrary number of user-specified buttons. More... | |
static int | warning (QWidget *parent, const QString &title, const QString &text, const int defaultButton, const int escapeButton, char *,...) |
Show warning message box with arbitrary number of user-specified buttons. More... | |
static int | information (QWidget *parent, const QString &title, const QString &text, const int defaultButton, const int escapeButton, char *,...) |
Show information message box with arbitrary number of user-specified buttons. More... | |
static int | question (QWidget *parent, const QString &title, const QString &text, const int defaultButton, const int escapeButton, char *,...) |
Show question message box with arbitrary number of user-specified buttons. More... | |
Private Types | |
typedef QList< ButtonInfo > | ButtonInfos |
Static Private Member Functions | |
static int | messageBox (SUIT_MessageBox::Icon icon, QWidget *parent, const QString &title, const QString &text, const ButtonInfos &lst, const int defaultButton=-1, const int escapeButton=-1) |
Create and show the message box. More... | |
static ButtonInfos | messageList (char *, va_list &) |
Parse arbitrary arguments list. More... | |
The class provides a modal dialog with a short message, an icon, and buttons laid out depending on the current style.
Message boxes are used to provide informative messages and to ask simple questions.
The easiest way to pop up a message box is to call one of the static functions information(), question(), critical(), and warning().
The class provides the static functions to show message boxes with standard buttons (like Ok
, Cancel
, Apply
, Close
, Yes
, No
, Abort
, Retry
, etc). These methods accept ORed buttons flags as one of the parameters. The buttons layouting type and order is system-dependant and defined by the current style. In addition, these methods allow to define default button (where input focus is set by default and which is clicked when user presses Enter
key).
Another set of static functions allows to show message boxes with up to four user-defined buttons. It is possible to define default and escape buttons using additional parameters.
And finally, the last group of static functions allow displaying the message boxes with an arbitrary number of buttons.
For example:
|
private |
SUIT_MessageBox::SUIT_MessageBox | ( | QWidget * | parent = 0 | ) |
parent | parent widget |
SUIT_MessageBox::SUIT_MessageBox | ( | Icon | icon, |
const QString & | title, | ||
const QString & | text, | ||
StandardButtons | buttons = NoButton , |
||
QWidget * | parent = 0 , |
||
Qt::WindowFlags | f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint |
||
) |
icon | message box icon (QMessageBox::Icon) |
title | message box title |
text | message box text |
buttons | ORed message box standard buttons (QMessageBox::StandardButton) |
parent | parent widget |
f | window flags |
SUIT_MessageBox::~SUIT_MessageBox | ( | ) |
QString SUIT_MessageBox::buttonText | ( | StandardButton | btn | ) | const |
btn | standard button id |
|
static |
parent | parent widget |
title | message box title |
text | message box text |
buttons | ORed message box buttons (QMessageBox::StandardButton) |
defaultButton | default button (QMessageBox::StandardButton) |
|
static |
Specified button becomes "default" button and "escape" button, i.e. pressing Return
or Enter
and Escape
keys is equivalent to clicking this button.
parent | parent widget |
title | message box title |
text | message box text |
button | button text |
References messageBox().
|
static |
Parameters button1 and button2 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the second one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
Parameters button1, button2 and button3 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
button3 | third button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
Parameters button1, button2, button3 and button4 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
button3 | third button text |
button4 | fourth button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
List of buttons to be shown is specified via buttons parameter.
The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
defaultButton | default button |
escapeButton | escape button |
buttons | list of buttons to be shown |
References messageBox().
|
static |
The function accepts arbitrary number of parameters. Each parameter starting from btn should be of type const char* to specify the button text. After the last button parameter and additional 0 (zero) value should be specified.
The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
defaultButton | default button |
escapeButton | escape button |
btn | first button text |
References messageBox(), and messageList().
|
static |
parent | parent widget |
title | message box title |
text | message box text |
buttons | ORed message box buttons (QMessageBox::StandardButton) |
defaultButton | default button (QMessageBox::StandardButton) |
|
static |
Specified button becomes "default" button and "escape" button, i.e. pressing Return
or Enter
and Escape
keys is equivalent to clicking this button.
parent | parent widget |
title | message box title |
text | message box text |
button | button text |
References messageBox().
|
static |
Parameters button1 and button2 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the second one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
Parameters button1, button2 and button3 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
button3 | third button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
Parameters button1, button2, button3 and button4 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
button3 | third button text |
button4 | fourth button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
List of buttons to be shown is specified via buttons parameter.
The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
defaultButton | default button |
escapeButton | escape button |
buttons | list of buttons to be shown |
References messageBox().
|
static |
The function accepts arbitrary number of parameters. Each parameter starting from btn should be of type const char* to specify the button text. After the last button parameter and additional 0 (zero) value should be specified.
The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
defaultButton | default button |
escapeButton | escape button |
btn | first button text |
References messageBox(), and messageList().
|
staticprivate |
icon | icon type |
parent | parent widget |
title | message box title |
text | message box text |
lst | list of buttons infos |
defaultButton | default button |
escapeButton | escape button |
|
staticprivate |
The last parameter in a sequence should be 0 (zero) value.
txt | first argument which starts arbitrary sequence |
args | arguments list from the stack |
|
static |
parent | parent widget |
title | message box title |
text | message box text |
buttons | ORed message box buttons (QMessageBox::StandardButton) |
defaultButton | default button (QMessageBox::StandardButton) |
|
static |
Specified button becomes "default" button and "escape" button, i.e. pressing Return
or Enter
and Escape
keys is equivalent to clicking this button.
parent | parent widget |
title | message box title |
text | message box text |
button | button text |
References messageBox().
|
static |
Parameters button1 and button2 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the second one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
Parameters button1, button2 and button3 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
button3 | third button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
Parameters button1, button2, button3 and button4 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
button3 | third button text |
button4 | fourth button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
List of buttons to be shown is specified via buttons parameter.
The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
defaultButton | default button |
escapeButton | escape button |
buttons | list of buttons to be shown |
References messageBox().
|
static |
The function accepts arbitrary number of parameters. Each parameter starting from btn should be of type const char* to specify the button text. After the last button parameter and additional 0 (zero) value should be specified.
The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
defaultButton | default button |
escapeButton | escape button |
btn | first button text |
References messageBox(), and messageList().
void SUIT_MessageBox::setButtonText | ( | StandardButton | btn, |
const QString & | text | ||
) |
btn | standard button id |
text | new button text |
|
static |
|
static |
Specified button becomes "default" button and "escape" button, i.e. pressing Return
or Enter
and Escape
keys is equivalent to clicking this button.
parent | parent widget |
title | message box title |
text | message box text |
button | button text |
References messageBox().
|
static |
Parameters button1 and button2 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the second one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
Parameters button1, button2 and button3 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
button3 | third button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
Parameters button1, button2, button3 and button4 specify the buttons text. The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
button1 | first button text |
button2 | second button text |
button3 | third button text |
button4 | fourth button text |
defaultButton | default button |
escapeButton | escape button |
References messageBox().
|
static |
List of buttons to be shown is specified via buttons parameter.
The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
defaultButton | default button |
escapeButton | escape button |
buttons | list of buttons to be shown |
References messageBox().
|
static |
The function accepts arbitrary number of parameters. Each parameter starting from btn should be of type const char* to specify the button text. After the last button parameter and additional 0 (zero) value should be specified.
The function returns clicked button id. The identifiers for the buttons are assigned automatically. The first button is identified as 0, the second one as 1, etc.
The defaultButton parameter allows to specify the button which is assigned for the Return
or Enter
key. Similarly, escapeButton parameter allows specifing the button which is assigned for Escape
key. If these parameters are not specified (-1 by default), the first button is set as default button and the last one is defined as escape button.
parent | parent widget |
title | message box title |
text | message box text |
defaultButton | default button |
escapeButton | escape button |
btn | first button text |
References messageBox(), and messageList().