- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties

# QMessageBox Class Reference

Search for all occurrences

## Detailed Description

Definition at line 59 of file qmessagebox.h.

`#include <qmessagebox.h>`

Inheritance diagram for QMessageBox:
[legend]

List of all members.

## Public Types
enum | Icon { NoIcon = 0, Information = 1, Warning = 2, Critical = 3, Question = 4 }
enum | ButtonRole { InvalidRole = -1, AcceptRole, RejectRole, DestructiveRole, ActionRole, HelpRole, YesRole, NoRole, ResetRole, ApplyRole, NRoles }
enum | StandardButton { NoButton = 0x00000000, Ok = 0x00000400, Save = 0x00000800, SaveAll = 0x00001000, Open = 0x00002000, Yes = 0x00004000, YesToAll = 0x00008000, No = 0x00010000, NoToAll = 0x00020000, Abort = 0x00040000, Retry = 0x00080000, Ignore = 0x00100000, Close = 0x00200000, Cancel = 0x00400000, Discard = 0x00800000, Help = 0x01000000, Apply = 0x02000000, Reset = 0x04000000, RestoreDefaults = 0x08000000, FirstButton = Ok, LastButton = RestoreDefaults, YesAll = YesToAll, NoAll = NoToAll, Default = 0x00000100, Escape = 0x00000200, FlagMask = 0x00000300, ButtonMask = ~FlagMask }
typedef StandardButton | Button
## Signals
void | buttonClicked (QAbstractButton *button)
## Public Member Functions
| QMessageBox (QWidget *parent=0)
| QMessageBox (Icon icon, const QString &title, const QString &text, StandardButtons buttons=NoButton, QWidget *parent=0, Qt::WindowFlags flags=Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint)
| ~QMessageBox ()
void | addButton (QAbstractButton *button, ButtonRole role)
QPushButton * | addButton (const QString &text, ButtonRole role)
QPushButton * | addButton (StandardButton button)
void | removeButton (QAbstractButton *button)
void | open (QObject *receiver, const char *member)
QList< QAbstractButton * > | buttons () const
ButtonRole | buttonRole (QAbstractButton *button) const
void | setStandardButtons (StandardButtons buttons)
StandardButtons | standardButtons () const
StandardButton | standardButton (QAbstractButton *button) const
QAbstractButton * | button (StandardButton which) const
QPushButton * | defaultButton () const
void | setDefaultButton (QPushButton *button)
void | setDefaultButton (StandardButton button)
QAbstractButton * | escapeButton () const
void | setEscapeButton (QAbstractButton *button)
void | setEscapeButton (StandardButton button)
QAbstractButton * | clickedButton () const
QString | text () const
void | setText (const QString &text)
Icon | icon () const
void | setIcon (Icon)
QPixmap | iconPixmap () const
void | setIconPixmap (const QPixmap &pixmap)
Qt::TextFormat | textFormat () const
void | setTextFormat (Qt::TextFormat format)
QSize | sizeHint () const
| QMessageBox (const QString &title, const QString &text, Icon icon, int button0, int button1, int button2, QWidget *parent=0, Qt::WindowFlags f=Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint)
QString | buttonText (int button) const
void | setButtonText (int button, const QString &text)
QString | informativeText () const
void | setInformativeText (const QString &text)
QString | detailedText () const
void | setDetailedText (const QString &text)
void | setWindowTitle (const QString &title)
void | setWindowModality (Qt::WindowModality windowModality)
## Static Public Member Functions
static StandardButton | information (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static StandardButton | question (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static StandardButton | warning (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static StandardButton | critical (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static void | about (QWidget *parent, const QString &title, const QString &text)
static void | aboutQt (QWidget *parent, const QString &title=QString())
static int | information (QWidget *parent, const QString &title, const QString &text, int button0, int button1=0, int button2=0)
static int | information (QWidget *parent, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text=QString(), const QString &button2Text=QString(), int defaultButtonNumber=0, int escapeButtonNumber=-1)
static StandardButton | information (QWidget *parent, const QString &title, const QString &text, StandardButton button0, StandardButton button1=NoButton)
static int | question (QWidget *parent, const QString &title, const QString &text, int button0, int button1=0, int button2=0)
static int | question (QWidget *parent, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text=QString(), const QString &button2Text=QString(), int defaultButtonNumber=0, int escapeButtonNumber=-1)
static int | question (QWidget *parent, const QString &title, const QString &text, StandardButton button0, StandardButton button1)
static int | warning (QWidget *parent, const QString &title, const QString &text, int button0, int button1, int button2=0)
static int | warning (QWidget *parent, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text=QString(), const QString &button2Text=QString(), int defaultButtonNumber=0, int escapeButtonNumber=-1)
static int | warning (QWidget *parent, const QString &title, const QString &text, StandardButton button0, StandardButton button1)
static int | critical (QWidget *parent, const QString &title, const QString &text, int button0, int button1, int button2=0)
static int | critical (QWidget *parent, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text=QString(), const QString &button2Text=QString(), int defaultButtonNumber=0, int escapeButtonNumber=-1)
static int | critical (QWidget *parent, const QString &title, const QString &text, StandardButton button0, StandardButton button1)
static QPixmap | standardIcon (Icon icon)
## Protected Member Functions
bool | event (QEvent *e)
void | resizeEvent (QResizeEvent *event)
void | showEvent (QShowEvent *event)
void | closeEvent (QCloseEvent *event)
void | keyPressEvent (QKeyEvent *event)
void | changeEvent (QEvent *event)
## Properties
QString | text
Icon | icon
QPixmap | iconPixmap
Qt::TextFormat | textFormat
StandardButtons | standardButtons
QString | detailedText
QString | informativeText

## Member Typedef Documentation

typedef StandardButton Button

Search for all occurrences

Definition at line 133 of file qmessagebox.h.

## Member Enumeration Documentation

enum Icon

Search for all occurrences

Enumerator:

  NoIcon | Search for all occurrences
  Information | Search for all occurrences
  Warning | Search for all occurrences
  Critical | Search for all occurrences
  Question | Search for all occurrences

Definition at line 76 of file qmessagebox.h.

                  {
            NoIcon = 0,
            Information = 1,
            Warning = 2,
            Critical = 3,
            Question = 4
        };

enum ButtonRole

Search for all occurrences

Enumerator:

  InvalidRole | Search for all occurrences
  AcceptRole | Search for all occurrences
  RejectRole | Search for all occurrences
  DestructiveRole | Search for all occurrences
  ActionRole | Search for all occurrences
  HelpRole | Search for all occurrences
  YesRole | Search for all occurrences
  NoRole | Search for all occurrences
  ResetRole | Search for all occurrences
  ApplyRole | Search for all occurrences
  NRoles | Search for all occurrences

Definition at line 84 of file qmessagebox.h.

                        {
            // keep this in sync with QDialogButtonBox::ButtonRole
            InvalidRole = -1,
            AcceptRole,
            RejectRole,
            DestructiveRole,
            ActionRole,
            HelpRole,
            YesRole,
            NoRole,
            ResetRole,
            ApplyRole,

            NRoles
        };

enum StandardButton

Search for all occurrences

Enumerator:

  NoButton | Search for all occurrences
  Ok | Search for all occurrences
  Save | Search for all occurrences
  SaveAll | Search for all occurrences
  Open | Search for all occurrences
  Yes | Search for all occurrences
  YesToAll | Search for all occurrences
  No | Search for all occurrences
  NoToAll | Search for all occurrences
  Abort | Search for all occurrences
  Retry | Search for all occurrences
  Ignore | Search for all occurrences
  Close | Search for all occurrences
  Cancel | Search for all occurrences
  Discard | Search for all occurrences
  Help | Search for all occurrences
  Apply | Search for all occurrences
  Reset | Search for all occurrences
  RestoreDefaults | Search for all occurrences
  FirstButton | Search for all occurrences
  LastButton | Search for all occurrences
  YesAll | Search for all occurrences
  NoAll | Search for all occurrences
  Default | Search for all occurrences
  Escape | Search for all occurrences
  FlagMask | Search for all occurrences
  ButtonMask | Search for all occurrences

Definition at line 100 of file qmessagebox.h.

                            {
            // keep this in sync with QDialogButtonBox::StandardButton
            NoButton           = 0x00000000,
            Ok                 = 0x00000400,
            Save               = 0x00000800,
            SaveAll            = 0x00001000,
            Open               = 0x00002000,
            Yes                = 0x00004000,
            YesToAll           = 0x00008000,
            No                 = 0x00010000,
            NoToAll            = 0x00020000,
            Abort              = 0x00040000,
            Retry              = 0x00080000,
            Ignore             = 0x00100000,
            Close              = 0x00200000,
            Cancel             = 0x00400000,
            Discard            = 0x00800000,
            Help               = 0x01000000,
            Apply              = 0x02000000,
            Reset              = 0x04000000,
            RestoreDefaults    = 0x08000000,

            FirstButton        = Ok,                // internal
            LastButton         = RestoreDefaults,   // internal

            YesAll             = YesToAll,          // obsolete
            NoAll              = NoToAll,           // obsolete

            Default            = 0x00000100,        // obsolete
            Escape             = 0x00000200,        // obsolete
            FlagMask           = 0x00000300,        // obsolete
            ButtonMask         = ~FlagMask          // obsolete
        };

## Constructor & Destructor Documentation

QMessageBox | ( | QWidget * | parent = `0` | ) | `[explicit]`

QMessageBox | ( | Icon | icon,
|  | const QString & | title,
|  | const QString & | text,
|  | StandardButtons | buttons = `NoButton`,
|  | QWidget * | parent = `0`,
|  | Qt::WindowFlags | flags = `Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint`
| ) |  |

~QMessageBox | ( |  | ) |

QMessageBox | ( | const QString & | title,
|  | const QString & | text,
|  | Icon | icon,
|  | int | button0,
|  | int | button1,
|  | int | button2,
|  | QWidget * | parent = `0`,
|  | Qt::WindowFlags | f = `Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint`
| ) |  |

## Member Function Documentation

void addButton | ( | QAbstractButton * | button,
|  | ButtonRole | role
| ) |  |

Search for all occurrences

QPushButton* addButton | ( | const QString & | text,
|  | ButtonRole | role
| ) |  |

Search for all occurrences

QPushButton* addButton | ( | StandardButton | button | ) |

Search for all occurrences

void removeButton | ( | QAbstractButton * | button | ) |

Search for all occurrences

void open | ( | QObject * | receiver,
|  | const char * | member
| ) |  |

Search for all occurrences

QList<QAbstractButton *> buttons | ( |  | ) | const

Search for all occurrences

ButtonRole buttonRole | ( | QAbstractButton * | button | ) | const

Search for all occurrences

void setStandardButtons | ( | StandardButtons | buttons | ) |

Search for all occurrences

StandardButtons standardButtons | ( |  | ) | const

Search for all occurrences

StandardButton standardButton | ( | QAbstractButton * | button | ) | const

Search for all occurrences

QAbstractButton* button | ( | StandardButton | which | ) | const

Search for all occurrences

QPushButton* defaultButton | ( |  | ) | const

Search for all occurrences

void setDefaultButton | ( | QPushButton * | button | ) |

Search for all occurrences

void setDefaultButton | ( | StandardButton | button | ) |

Search for all occurrences

QAbstractButton* escapeButton | ( |  | ) | const

Search for all occurrences

void setEscapeButton | ( | QAbstractButton * | button | ) |

Search for all occurrences

void setEscapeButton | ( | StandardButton | button | ) |

Search for all occurrences

QAbstractButton* clickedButton | ( |  | ) | const

Search for all occurrences

QString text | ( |  | ) | const

Search for all occurrences

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

Search for all occurrences

Icon icon | ( |  | ) | const

Search for all occurrences

void setIcon | ( | Icon |  | ) |

Search for all occurrences

QPixmap iconPixmap | ( |  | ) | const

Search for all occurrences

void setIconPixmap | ( | const QPixmap & | pixmap | ) |

Search for all occurrences

Qt::TextFormat textFormat | ( |  | ) | const

Search for all occurrences

void setTextFormat | ( | Qt::TextFormat | format | ) |

Search for all occurrences

static StandardButton information | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | StandardButtons | buttons = `Ok`,
|  | StandardButton | defaultButton = `NoButton`
| ) |  | `[static]`

Search for all occurrences

Examples:
  TextureConveyor/TextureConveyor.cpp.

static StandardButton question | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | StandardButtons | buttons = `Ok`,
|  | StandardButton | defaultButton = `NoButton`
| ) |  | `[static]`

Search for all occurrences

Examples:
  TextureConveyor/TextureConveyor.cpp.

static StandardButton warning | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | StandardButtons | buttons = `Ok`,
|  | StandardButton | defaultButton = `NoButton`
| ) |  | `[static]`

Search for all occurrences

static StandardButton critical | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | StandardButtons | buttons = `Ok`,
|  | StandardButton | defaultButton = `NoButton`
| ) |  | `[static]`

Search for all occurrences

static void about | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text
| ) |  | `[static]`

Search for all occurrences

static void aboutQt | ( | QWidget * | parent,
|  | const QString & | title = `QString()`
| ) |  | `[static]`

Search for all occurrences

QSize sizeHint | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QDialog.

static int information | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | int | button0,
|  | int | button1 = `0`,
|  | int | button2 = `0`
| ) |  | `[static]`

Search for all occurrences

static int information | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | const QString & | button0Text,
|  | const QString & | button1Text = `QString()`,
|  | const QString & | button2Text = `QString()`,
|  | int | defaultButtonNumber = `0`,
|  | int | escapeButtonNumber = `-1`
| ) |  | `[static]`

Search for all occurrences

static StandardButton information | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | StandardButton | button0,
|  | StandardButton | button1 = `NoButton`
| ) |  | `[inline, static]`

Search for all occurrences

Definition at line 227 of file qmessagebox.h.

        { return information(parent, title, text, StandardButtons(button0), button1); }

static int question | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | int | button0,
|  | int | button1 = `0`,
|  | int | button2 = `0`
| ) |  | `[static]`

Search for all occurrences

static int question | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | const QString & | button0Text,
|  | const QString & | button1Text = `QString()`,
|  | const QString & | button2Text = `QString()`,
|  | int | defaultButtonNumber = `0`,
|  | int | escapeButtonNumber = `-1`
| ) |  | `[static]`

Search for all occurrences

static int question | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | StandardButton | button0,
|  | StandardButton | button1
| ) |  | `[inline, static]`

Search for all occurrences

Definition at line 242 of file qmessagebox.h.

        { return question(parent, title, text, StandardButtons(button0), button1); }

static int warning | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | int | button0,
|  | int | button1,
|  | int | button2 = `0`
| ) |  | `[static]`

Search for all occurrences

static int warning | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | const QString & | button0Text,
|  | const QString & | button1Text = `QString()`,
|  | const QString & | button2Text = `QString()`,
|  | int | defaultButtonNumber = `0`,
|  | int | escapeButtonNumber = `-1`
| ) |  | `[static]`

Search for all occurrences

static int warning | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | StandardButton | button0,
|  | StandardButton | button1
| ) |  | `[inline, static]`

Search for all occurrences

Definition at line 257 of file qmessagebox.h.

        { return warning(parent, title, text, StandardButtons(button0), button1); }

static int critical | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | int | button0,
|  | int | button1,
|  | int | button2 = `0`
| ) |  | `[static]`

Search for all occurrences

static int critical | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | const QString & | button0Text,
|  | const QString & | button1Text = `QString()`,
|  | const QString & | button2Text = `QString()`,
|  | int | defaultButtonNumber = `0`,
|  | int | escapeButtonNumber = `-1`
| ) |  | `[static]`

Search for all occurrences

static int critical | ( | QWidget * | parent,
|  | const QString & | title,
|  | const QString & | text,
|  | StandardButton | button0,
|  | StandardButton | button1
| ) |  | `[inline, static]`

Search for all occurrences

Definition at line 272 of file qmessagebox.h.

        { return critical(parent, title, text, StandardButtons(button0), button1); }

QString buttonText | ( | int | button | ) | const

Search for all occurrences

void setButtonText | ( | int | button,
|  | const QString & | text
| ) |  |

Search for all occurrences

QString informativeText | ( |  | ) | const

Search for all occurrences

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

Search for all occurrences

QString detailedText | ( |  | ) | const

Search for all occurrences

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

Search for all occurrences

void setWindowTitle | ( | const QString & | title | ) |

Search for all occurrences

Reimplemented from QWidget.

void setWindowModality | ( | Qt::WindowModality | windowModality | ) |

Search for all occurrences

Reimplemented from QWidget.

static QPixmap standardIcon | ( | Icon | icon | ) | `[static]`

Search for all occurrences

void buttonClicked | ( | QAbstractButton * | button | ) | `[signal]`

Search for all occurrences

bool event | ( | QEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void resizeEvent | ( | QResizeEvent * | event | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QDialog.

void showEvent | ( | QShowEvent * | event | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QDialog.

void closeEvent | ( | QCloseEvent * | event | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QDialog.

void keyPressEvent | ( | QKeyEvent * | event | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QDialog.

void changeEvent | ( | QEvent * | event | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

## Property Documentation

QString text `[read, write]`

Search for all occurrences

Definition at line 64 of file qmessagebox.h.

Icon icon `[read, write]`

Search for all occurrences

Definition at line 66 of file qmessagebox.h.

QPixmap iconPixmap `[read, write]`

Search for all occurrences

Definition at line 67 of file qmessagebox.h.

Qt::TextFormat textFormat `[read, write]`

Search for all occurrences

Definition at line 68 of file qmessagebox.h.

StandardButtons standardButtons `[read, write]`

Search for all occurrences

Definition at line 69 of file qmessagebox.h.

QString detailedText `[read, write]`

Search for all occurrences

Definition at line 71 of file qmessagebox.h.

QString informativeText `[read, write]`

Search for all occurrences

Definition at line 73 of file qmessagebox.h.

The documentation for this class was generated from the following file:

- QtGui/qmessagebox.h

QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox
QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox QMessageBox