Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > d5e62c01ae8d1e579463c6a871dd44bf > files > 3948

qtbase5-doc-5.12.6-2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qmessagebox.cpp -->
  <title>QMessageBox Class | Qt Widgets 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QMessageBox</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#the-property-based-api">The Property-based API</a></li>
<li class="level2"><a href="#the-static-functions-api">The Static Functions API</a></li>
<li class="level2"><a href="#advanced-usage">Advanced Usage</a></li>
<li class="level2"><a href="#default-and-escape-keys">Default and Escape Keys</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QMessageBox Class</h1>
<!-- $$$QMessageBox-brief -->
<p>The <a href="qmessagebox.html">QMessageBox</a> class provides a modal dialog for informing the user or for asking the user a question and receiving an answer. <a href="#details">More...</a></p>
<!-- @@@QMessageBox -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QMessageBox&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qdialog.html">QDialog</a></td></tr></table></div><ul>
<li><a href="qmessagebox-members.html">List of all members, including inherited members</a></li>
<li><a href="qmessagebox-obsolete.html">Obsolete members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a></b> { InvalidRole, AcceptRole, RejectRole, DestructiveRole, ..., NRoles }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#Icon-enum">Icon</a></b> { NoIcon, Question, Information, Warning, Critical }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#StandardButton-enum">StandardButton</a></b> { Ok, Open, Save, Cancel, ..., ButtonMask }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#StandardButton-enum">StandardButtons</a></b></td></tr>
</table></div>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<div class="table"><table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qmessagebox.html#detailedText-prop">detailedText</a></b> : QString</li>
<li class="fn"><b><a href="qmessagebox.html#icon-prop">icon</a></b> : Icon</li>
<li class="fn"><b><a href="qmessagebox.html#iconPixmap-prop">iconPixmap</a></b> : QPixmap</li>
<li class="fn"><b><a href="qmessagebox.html#informativeText-prop">informativeText</a></b> : QString</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qmessagebox.html#standardButtons-prop">standardButtons</a></b> : StandardButtons</li>
<li class="fn"><b><a href="qmessagebox.html#text-prop">text</a></b> : QString</li>
<li class="fn"><b><a href="qmessagebox.html#textFormat-prop">textFormat</a></b> : Qt::TextFormat</li>
<li class="fn"><b><a href="qmessagebox.html#textInteractionFlags-prop">textInteractionFlags</a></b> : Qt::TextInteractionFlags</li>
</ul>
</td></tr>
</table></div>
<ul>
<li class="fn">2 properties inherited from <a href="qdialog.html#properties">QDialog</a></li>
<li class="fn">59 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#QMessageBox">QMessageBox</a></b>(QWidget *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#QMessageBox-1">QMessageBox</a></b>(QMessageBox::Icon <i>icon</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>, QMessageBox::StandardButtons <i>buttons</i>, QWidget *<i>parent</i> = nullptr, Qt::WindowFlags <i>f</i> = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#dtor.QMessageBox">~QMessageBox</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#addButton">addButton</a></b>(QAbstractButton *<i>button</i>, QMessageBox::ButtonRole <i>role</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPushButton *</td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#addButton-1">addButton</a></b>(const QString &amp;<i>text</i>, QMessageBox::ButtonRole <i>role</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPushButton *</td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#addButton-2">addButton</a></b>(QMessageBox::StandardButton <i>button</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAbstractButton *</td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#button">button</a></b>(QMessageBox::StandardButton <i>which</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMessageBox::ButtonRole </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#buttonRole">buttonRole</a></b>(QAbstractButton *<i>button</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QAbstractButton *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#buttons">buttons</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCheckBox *</td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#checkBox">checkBox</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAbstractButton *</td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#clickedButton">clickedButton</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPushButton *</td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#defaultButton">defaultButton</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#detailedText-prop">detailedText</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAbstractButton *</td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#escapeButton">escapeButton</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMessageBox::Icon </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#icon-prop">icon</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPixmap </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#iconPixmap-prop">iconPixmap</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#informativeText-prop">informativeText</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#open">open</a></b>(QObject *<i>receiver</i>, const char *<i>member</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#removeButton">removeButton</a></b>(QAbstractButton *<i>button</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#setCheckBox">setCheckBox</a></b>(QCheckBox *<i>cb</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#setDefaultButton">setDefaultButton</a></b>(QPushButton *<i>button</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#setDefaultButton-1">setDefaultButton</a></b>(QMessageBox::StandardButton <i>button</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#detailedText-prop">setDetailedText</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#setEscapeButton">setEscapeButton</a></b>(QAbstractButton *<i>button</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#setEscapeButton-1">setEscapeButton</a></b>(QMessageBox::StandardButton <i>button</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#icon-prop">setIcon</a></b>(<i>QMessageBox::Icon</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#iconPixmap-prop">setIconPixmap</a></b>(const QPixmap &amp;<i>pixmap</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#informativeText-prop">setInformativeText</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a></b>(QMessageBox::StandardButtons <i>buttons</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#text-prop">setText</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#textFormat-prop">setTextFormat</a></b>(Qt::TextFormat <i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#textInteractionFlags-prop">setTextInteractionFlags</a></b>(Qt::TextInteractionFlags <i>flags</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#setWindowModality">setWindowModality</a></b>(Qt::WindowModality <i>windowModality</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#setWindowTitle">setWindowTitle</a></b>(const QString &amp;<i>title</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMessageBox::StandardButton </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#standardButton">standardButton</a></b>(QAbstractButton *<i>button</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMessageBox::StandardButtons </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#standardButtons-prop">standardButtons</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#text-prop">text</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::TextFormat </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#textFormat-prop">textFormat</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::TextInteractionFlags </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#textInteractionFlags-prop">textInteractionFlags</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">8 public functions inherited from <a href="qdialog.html#public-functions">QDialog</a></li>
<li class="fn">214 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
<li class="fn">14 public functions inherited from <a href="../qtgui/qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#exec">exec</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">5 public slots inherited from <a href="qdialog.html#public-slots">QDialog</a></li>
<li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#buttonClicked">buttonClicked</a></b>(QAbstractButton *<i>button</i>)</td></tr>
</table></div>
<ul>
<li class="fn">3 signals inherited from <a href="qdialog.html#signals">QDialog</a></li>
<li class="fn">3 signals inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#about">about</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#aboutQt">aboutQt</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i> = QString())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMessageBox::StandardButton </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#critical">critical</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>, QMessageBox::StandardButtons <i>buttons</i>, QMessageBox::StandardButton <i>defaultButton</i> = NoButton)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#critical-3">critical</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>, QMessageBox::StandardButton <i>button0</i>, QMessageBox::StandardButton <i>button1</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMessageBox::StandardButton </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#information">information</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>, QMessageBox::StandardButtons <i>buttons</i>, QMessageBox::StandardButton <i>defaultButton</i> = NoButton)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMessageBox::StandardButton </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#information-3">information</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>, QMessageBox::StandardButton <i>button0</i>, QMessageBox::StandardButton <i>button1</i> = NoButton)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMessageBox::StandardButton </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#question">question</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>, QMessageBox::StandardButtons <i>buttons</i> = ..., QMessageBox::StandardButton <i>defaultButton</i> = NoButton)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#question-3">question</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>, QMessageBox::StandardButton <i>button0</i>, QMessageBox::StandardButton <i>button1</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#staticMetaObject-var">staticMetaObject</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMessageBox::StandardButton </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#warning">warning</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>, QMessageBox::StandardButtons <i>buttons</i>, QMessageBox::StandardButton <i>defaultButton</i> = NoButton)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#warning-3">warning</a></b>(QWidget *<i>parent</i>, const QString &amp;<i>title</i>, const QString &amp;<i>text</i>, QMessageBox::StandardButton <i>button0</i>, QMessageBox::StandardButton <i>button1</i>)</td></tr>
</table></div>
<ul>
<li class="fn">5 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">9 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#changeEvent">changeEvent</a></b>(QEvent *<i>ev</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#closeEvent">closeEvent</a></b>(QCloseEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#event">event</a></b>(QEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#keyPressEvent">keyPressEvent</a></b>(QKeyEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#resizeEvent">resizeEvent</a></b>(QResizeEvent *<i>event</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmessagebox.html#showEvent">showEvent</a></b>(QShowEvent *<i>e</i>) override</td></tr>
</table></div>
<ul>
<li class="fn">6 protected functions inherited from <a href="qdialog.html#protected-functions">QDialog</a></li>
<li class="fn">35 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">6 protected functions inherited from <a href="qdialog.html#protected-functions">QDialog</a></li>
<li class="fn">35 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</a></li>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<!-- $$$QMessageBox-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qmessagebox.html">QMessageBox</a> class provides a modal dialog for informing the user or for asking the user a question and receiving an answer.</p>
<p>A message box displays a primary <a href="qmessagebox.html#text-prop">text</a> to alert the user to a situation, an <a href="qmessagebox.html#informativeText-prop">informative text</a> to further explain the alert or to ask the user a question, and an optional <a href="qmessagebox.html#detailedText-prop">detailed text</a> to provide even more data if the user requests it. A message box can also display an <a href="qmessagebox.html#icon-prop">icon</a> and <a href="qmessagebox.html#standardButtons-prop">standard buttons</a> for accepting a user response.</p>
<p>Two APIs for using <a href="qmessagebox.html">QMessageBox</a> are provided, the property-based API, and the static functions. Calling one of the static functions is the simpler approach, but it is less flexible than using the property-based API, and the result is less informative. Using the property-based API is recommended.</p>
<a name="the-property-based-api"></a>
<h3 id="the-property-based-api">The Property-based API</h3>
<p>To use the property-based API, construct an instance of <a href="qmessagebox.html">QMessageBox</a>, set the desired properties, and call <a href="qmessagebox.html#exec">exec</a>() to show the message. The simplest configuration is to set only the <a href="qmessagebox.html#text-prop">message text</a> property.</p>
<pre class="cpp">

  <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span> msgBox;
  msgBox<span class="operator">.</span>setText(<span class="string">&quot;The document has been modified.&quot;</span>);
  msgBox<span class="operator">.</span>exec();

</pre>
<p>The user must click the <b>OK</b> button to dismiss the message box. The rest of the GUI is blocked until the message box is dismissed.</p>
<p class="centerAlign"><img src="images/msgbox1.png" alt="" /></p><p>A better approach than just alerting the user to an event is to also ask the user what to do about it. Store the question in the <a href="qmessagebox.html#informativeText-prop">informative text</a> property, and set the <a href="qmessagebox.html#standardButtons-prop">standard buttons</a> property to the set of buttons you want as the set of user responses. The buttons are specified by combining values from <a href="qmessagebox.html#StandardButton-enum">StandardButtons</a> using the bitwise OR operator. The display order for the buttons is platform-dependent. For example, on Windows, <b>Save</b> is displayed to the left of <b>Cancel</b>, whereas on Mac OS, the order is reversed.</p>
<p>Mark one of your standard buttons to be your <a href="qmessagebox.html#defaultButton">default button</a>.</p>
<pre class="cpp">

  <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span> msgBox;
  msgBox<span class="operator">.</span>setText(<span class="string">&quot;The document has been modified.&quot;</span>);
  msgBox<span class="operator">.</span>setInformativeText(<span class="string">&quot;Do you want to save your changes?&quot;</span>);
  msgBox<span class="operator">.</span>setStandardButtons(<span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Save <span class="operator">|</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Discard <span class="operator">|</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Cancel);
  msgBox<span class="operator">.</span>setDefaultButton(<span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Save);
  <span class="type">int</span> ret <span class="operator">=</span> msgBox<span class="operator">.</span>exec();

</pre>
<p>This is the approach recommended in the <a href="http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID">macOS Guidelines</a>. Similar guidelines apply for the other platforms, but note the different ways the <a href="qmessagebox.html#informativeText-prop">informative text</a> is handled for different platforms.</p>
<p class="centerAlign"><img src="images/msgbox2.png" alt="" /></p><p>The <a href="qmessagebox.html#exec">exec</a>() slot returns the <a href="qmessagebox.html#StandardButton-enum">StandardButtons</a> value of the button that was clicked.</p>
<pre class="cpp">

  <span class="keyword">switch</span> (ret) {
    <span class="keyword">case</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Save:
        <span class="comment">// Save was clicked</span>
        <span class="keyword">break</span>;
    <span class="keyword">case</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Discard:
        <span class="comment">// Don't Save was clicked</span>
        <span class="keyword">break</span>;
    <span class="keyword">case</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Cancel:
        <span class="comment">// Cancel was clicked</span>
        <span class="keyword">break</span>;
    <span class="keyword">default</span>:
        <span class="comment">// should never be reached</span>
        <span class="keyword">break</span>;
  }

</pre>
<p>To give the user more information to help him answer the question, set the <a href="qmessagebox.html#detailedText-prop">detailed text</a> property. If the <a href="qmessagebox.html#detailedText-prop">detailed text</a> property is set, the <b>Show Details..&#x2e;</b> button will be shown.</p>
<p class="centerAlign"><img src="images/msgbox3.png" alt="" /></p><p>Clicking the <b>Show Details..&#x2e;</b> button displays the detailed text.</p>
<p class="centerAlign"><img src="images/msgbox4.png" alt="" /></p><a name="rich-text-and-the-text-format-property"></a>
<h4 id="rich-text-and-the-text-format-property">Rich Text and the Text Format Property</h4>
<p>The <a href="qmessagebox.html#detailedText-prop">detailed text</a> property is always interpreted as plain text. The <a href="qmessagebox.html#text-prop">main text</a> and <a href="qmessagebox.html#informativeText-prop">informative text</a> properties can be either plain text or rich text. These strings are interpreted according to the setting of the <a href="qmessagebox.html#textFormat-prop">text format</a> property. The default setting is <a href="../qtcore/qt.html#TextFormat-enum">auto-text</a>.</p>
<p>Note that for some plain text strings containing XML meta-characters, the auto-text <a href="../qtgui/qt-sub-qtgui.html#mightBeRichText">rich text detection test</a> may fail causing your plain text string to be interpreted incorrectly as rich text. In these rare cases, use <a href="../qtgui/qt-sub-qtgui.html#convertFromPlainText">Qt::convertFromPlainText</a>() to convert your plain text string to a visually equivalent rich text string, or set the <a href="qmessagebox.html#textFormat-prop">text format</a> property explicitly with <a href="qmessagebox.html#textFormat-prop">setTextFormat</a>().</p>
<a name="severity-levels-and-the-icon-and-pixmap-properties"></a>
<h4 id="severity-levels-and-the-icon-and-pixmap-properties">Severity Levels and the Icon and Pixmap Properties</h4>
<p><a href="qmessagebox.html">QMessageBox</a> supports four predefined message severity levels, or message types, which really only differ in the predefined icon they each show. Specify one of the four predefined message types by setting the <a href="qmessagebox.html#icon-prop">icon</a> property to one of the <a href="qmessagebox.html#Icon-enum">predefined icons</a>. The following rules are guidelines:</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/qmessagebox-quest.png" alt="" /></p></td><td ><a href="qmessagebox.html#Icon-enum">Question</a></td><td >For asking a question during normal operations.</td></tr>
<tr valign="top" class="even"><td ><p class="centerAlign"><img src="images/qmessagebox-info.png" alt="" /></p></td><td ><a href="qmessagebox.html#Icon-enum">Information</a></td><td >For reporting information about normal operations.</td></tr>
<tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/qmessagebox-warn.png" alt="" /></p></td><td ><a href="qmessagebox.html#Icon-enum">Warning</a></td><td >For reporting non-critical errors.</td></tr>
<tr valign="top" class="even"><td ><p class="centerAlign"><img src="images/qmessagebox-crit.png" alt="" /></p></td><td ><a href="qmessagebox.html#Icon-enum">Critical</a></td><td >For reporting critical errors.</td></tr>
</table></div>
<p><a href="qmessagebox.html#Icon-enum">Predefined icons</a> are not defined by <a href="qmessagebox.html">QMessageBox</a>, but provided by the style. The default value is <a href="qmessagebox.html#Icon-enum">No Icon</a>. The message boxes are otherwise the same for all cases. When using a standard icon, use the one recommended in the table, or use the one recommended by the style guidelines for your platform. If none of the standard icons is right for your message box, you can use a custom icon by setting the <a href="qmessagebox.html#iconPixmap-prop">icon pixmap</a> property instead of setting the <a href="qmessagebox.html#icon-prop">icon</a> property.</p>
<p>In summary, to set an icon, use <i>either</i> <a href="qmessagebox.html#icon-prop">setIcon</a>() for one of the standard icons, <i>or</i> <a href="qmessagebox.html#iconPixmap-prop">setIconPixmap</a>() for a custom icon.</p>
<a name="the-static-functions-api"></a>
<h3 id="the-static-functions-api">The Static Functions API</h3>
<p>Building message boxes with the static functions API, although convenient, is less flexible than using the property-based API, because the static function signatures lack parameters for setting the <a href="qmessagebox.html#informativeText-prop">informative text</a> and <a href="qmessagebox.html#detailedText-prop">detailed text</a> properties. One work-around for this has been to use the <code>title</code> parameter as the message box main text and the <code>text</code> parameter as the message box informative text. Because this has the obvious drawback of making a less readable message box, platform guidelines do not recommend it. The <i>Microsoft Windows User Interface Guidelines</i> recommend using the <a href="../qtcore/qcoreapplication.html#applicationName-prop">application name</a> as the <a href="qmessagebox.html#setWindowTitle">window's title</a>, which means that if you have an informative text in addition to your main text, you must concatenate it to the <code>text</code> parameter.</p>
<p>Note that the static function signatures have changed with respect to their button parameters, which are now used to set the <a href="qmessagebox.html#standardButtons-prop">standard buttons</a> and the <a href="qmessagebox.html#defaultButton">default button</a>.</p>
<p>Static functions are available for creating <a href="qmessagebox.html#information">information</a>(), <a href="qmessagebox.html#question">question</a>(), <a href="qmessagebox.html#warning">warning</a>(), and <a href="qmessagebox.html#critical">critical</a>() message boxes.</p>
<pre class="cpp">

  <span class="type">int</span> ret <span class="operator">=</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>warning(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">&quot;My Application&quot;</span>)<span class="operator">,</span>
                                 tr(<span class="string">&quot;The document has been modified.\n&quot;</span>
                                    <span class="string">&quot;Do you want to save your changes?&quot;</span>)<span class="operator">,</span>
                                 <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Save <span class="operator">|</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Discard
                                 <span class="operator">|</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Cancel<span class="operator">,</span>
                                 <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Save);

</pre>
<p>The <a href="qtwidgets-dialogs-standarddialogs-example.html">Standard Dialogs</a> example shows how to use <a href="qmessagebox.html">QMessageBox</a> and the other built-in Qt dialogs.</p>
<a name="advanced-usage"></a>
<h3 id="advanced-usage">Advanced Usage</h3>
<p>If the <a href="qmessagebox.html#StandardButton-enum">standard buttons</a> are not flexible enough for your message box, you can use the <a href="qmessagebox.html#addButton">addButton</a>() overload that takes a text and a <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> to add custom buttons. The <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> is used by <a href="qmessagebox.html">QMessageBox</a> to determine the ordering of the buttons on screen (which varies according to the platform). You can test the value of <a href="qmessagebox.html#clickedButton">clickedButton</a>() after calling <a href="qmessagebox.html#exec">exec</a>(). For example,</p>
<pre class="cpp">

  <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span> msgBox;
  <span class="type"><a href="qpushbutton.html">QPushButton</a></span> <span class="operator">*</span>connectButton <span class="operator">=</span> msgBox<span class="operator">.</span>addButton(tr(<span class="string">&quot;Connect&quot;</span>)<span class="operator">,</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>ActionRole);
  <span class="type"><a href="qpushbutton.html">QPushButton</a></span> <span class="operator">*</span>abortButton <span class="operator">=</span> msgBox<span class="operator">.</span>addButton(<span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>Abort);

  msgBox<span class="operator">.</span>exec();

  <span class="keyword">if</span> (msgBox<span class="operator">.</span>clickedButton() <span class="operator">=</span><span class="operator">=</span> connectButton) {
      <span class="comment">// connect</span>
  } <span class="keyword">else</span> <span class="keyword">if</span> (msgBox<span class="operator">.</span>clickedButton() <span class="operator">=</span><span class="operator">=</span> abortButton) {
      <span class="comment">// abort</span>
  }

</pre>
<a name="default-and-escape-keys"></a>
<h3 id="default-and-escape-keys">Default and Escape Keys</h3>
<p>The default button (i.e&#x2e;, the button activated when <b>Enter</b> is pressed) can be specified using <a href="qmessagebox.html#setDefaultButton">setDefaultButton</a>(). If a default button is not specified, <a href="qmessagebox.html">QMessageBox</a> tries to find one based on the <a href="qmessagebox.html#ButtonRole-enum">button roles</a> of the buttons used in the message box.</p>
<p>The escape button (the button activated when <b>Esc</b> is pressed) can be specified using <a href="qmessagebox.html#setEscapeButton">setEscapeButton</a>(). If an escape button is not specified, <a href="qmessagebox.html">QMessageBox</a> tries to find one using these rules:</p>
<ol class="1" type="1"><li>If there is only one button, it is the button activated when <b>Esc</b> is pressed.</li>
<li>If there is a <a href="qmessagebox.html#StandardButton-enum">Cancel</a> button, it is the button activated when <b>Esc</b> is pressed.</li>
<li>If there is exactly one button having either <a href="qmessagebox.html#ButtonRole-enum">the Reject role</a> or the <a href="qmessagebox.html#ButtonRole-enum">the No role</a>, it is the button activated when <b>Esc</b> is pressed.</li>
</ol>
<p>When an escape button can't be determined using these rules, pressing <b>Esc</b> has no effect.</p>
</div>
<p><b>See also </b><a href="qdialogbuttonbox.html">QDialogButtonBox</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Message Box</a>, <a href="qtwidgets-dialogs-standarddialogs-example.html">Standard Dialogs Example</a>, and <a href="qtwidgets-mainwindows-application-example.html">Application Example</a>.</p>
<!-- @@@QMessageBox -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Icon$$$NoIcon$$$Information$$$Warning$$$Critical$$$Question -->
<h3 class="fn" id="Icon-enum"><a name="Icon-enum"></a>enum QMessageBox::<span class="name">Icon</span></h3>
<p>This enum has the following values:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QMessageBox::NoIcon</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">the message box does not have any icon.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Question</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">an icon indicating that the message is asking a question.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Information</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">an icon indicating that the message is nothing out of the ordinary.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Warning</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">an icon indicating that the message is a warning, but can be dealt with.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Critical</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">an icon indicating that the message represents a critical problem.</td></tr>
</table></div>
<!-- @@@Icon -->
<!-- $$$StandardButton$$$NoButton$$$Ok$$$Save$$$SaveAll$$$Open$$$Yes$$$YesToAll$$$No$$$NoToAll$$$Abort$$$Retry$$$Ignore$$$Close$$$Cancel$$$Discard$$$Help$$$Apply$$$Reset$$$RestoreDefaults$$$FirstButton$$$LastButton$$$YesAll$$$NoAll$$$Default$$$Escape$$$FlagMask$$$ButtonMask -->
<h3 class="flags" id="StandardButton-enum"><a name="StandardButton-enum"></a>enum QMessageBox::<span class="name">StandardButton</span><br/>flags QMessageBox::<span class="name">StandardButtons</span></h3>
<p>These enums describe flags for standard buttons. Each button has a defined <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QMessageBox::Ok</code></td><td class="topAlign tblval"><code>0x00000400</code></td><td class="topAlign">An &quot;OK&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Open</code></td><td class="topAlign tblval"><code>0x00002000</code></td><td class="topAlign">An &quot;Open&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Save</code></td><td class="topAlign tblval"><code>0x00000800</code></td><td class="topAlign">A &quot;Save&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Cancel</code></td><td class="topAlign tblval"><code>0x00400000</code></td><td class="topAlign">A &quot;Cancel&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">RejectRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Close</code></td><td class="topAlign tblval"><code>0x00200000</code></td><td class="topAlign">A &quot;Close&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">RejectRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Discard</code></td><td class="topAlign tblval"><code>0x00800000</code></td><td class="topAlign">A &quot;Discard&quot; or &quot;Don't Save&quot; button, depending on the platform, defined with the <a href="qmessagebox.html#ButtonRole-enum">DestructiveRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Apply</code></td><td class="topAlign tblval"><code>0x02000000</code></td><td class="topAlign">An &quot;Apply&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">ApplyRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Reset</code></td><td class="topAlign tblval"><code>0x04000000</code></td><td class="topAlign">A &quot;Reset&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">ResetRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::RestoreDefaults</code></td><td class="topAlign tblval"><code>0x08000000</code></td><td class="topAlign">A &quot;Restore Defaults&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">ResetRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Help</code></td><td class="topAlign tblval"><code>0x01000000</code></td><td class="topAlign">A &quot;Help&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">HelpRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::SaveAll</code></td><td class="topAlign tblval"><code>0x00001000</code></td><td class="topAlign">A &quot;Save All&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Yes</code></td><td class="topAlign tblval"><code>0x00004000</code></td><td class="topAlign">A &quot;Yes&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">YesRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::YesToAll</code></td><td class="topAlign tblval"><code>0x00008000</code></td><td class="topAlign">A &quot;Yes to All&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">YesRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::No</code></td><td class="topAlign tblval"><code>0x00010000</code></td><td class="topAlign">A &quot;No&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">NoRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::NoToAll</code></td><td class="topAlign tblval"><code>0x00020000</code></td><td class="topAlign">A &quot;No to All&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">NoRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Abort</code></td><td class="topAlign tblval"><code>0x00040000</code></td><td class="topAlign">An &quot;Abort&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">RejectRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Retry</code></td><td class="topAlign tblval"><code>0x00080000</code></td><td class="topAlign">A &quot;Retry&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Ignore</code></td><td class="topAlign tblval"><code>0x00100000</code></td><td class="topAlign">An &quot;Ignore&quot; button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::NoButton</code></td><td class="topAlign tblval"><code>0x00000000</code></td><td class="topAlign">An invalid button.</td></tr>
</table></div>
<p>The following values are obsolete:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="even"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QMessageBox::YesAll</code></td><td class="topAlign tblval"><code>YesToAll</code></td><td class="topAlign">Use YesToAll instead.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::NoAll</code></td><td class="topAlign tblval"><code>NoToAll</code></td><td class="topAlign">Use NoToAll instead.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Default</code></td><td class="topAlign tblval"><code>0x00000100</code></td><td class="topAlign">Use the <code>defaultButton</code> argument of <a href="qmessagebox.html#information">information</a>(), <a href="qmessagebox.html#warning">warning</a>(), etc. instead, or call <a href="qmessagebox.html#setDefaultButton">setDefaultButton</a>().</td></tr>
<tr><td class="topAlign"><code>QMessageBox::Escape</code></td><td class="topAlign tblval"><code>0x00000200</code></td><td class="topAlign">Call <a href="qmessagebox.html#setEscapeButton">setEscapeButton</a>() instead.</td></tr>
<tr><td class="topAlign"><code>QMessageBox::FlagMask</code></td><td class="topAlign tblval"><code>0x00000300</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QMessageBox::ButtonMask</code></td><td class="topAlign tblval"><code>~FlagMask</code></td><td class="topAlign">&nbsp;</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 4.2.</p>
<p>The StandardButtons type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;StandardButton&gt;. It stores an OR combination of StandardButton values.</p>
<p><b>See also </b><a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> and <a href="qmessagebox.html#standardButtons-prop">standardButtons</a>.</p>
<!-- @@@StandardButton -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$detailedText-prop$$$detailedText$$$setDetailedTextconstQString& -->
<h3 class="fn" id="detailedText-prop"><a name="detailedText-prop"></a><span class="name">detailedText</span> : <span class="type"><a href="../qtcore/qstring.html">QString</a></span></h3>
<p>This property holds the text to be displayed in the details area.</p>
<p>The text will be interpreted as a plain text.</p>
<p>By default, this property contains an empty string.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>detailedText</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDetailedText</b></span>(const QString &amp;<i>text</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qmessagebox.html#text-prop">QMessageBox::text</a> and <a href="qmessagebox.html#informativeText-prop">QMessageBox::informativeText</a>.</p>
<!-- @@@detailedText -->
<!-- $$$icon-prop$$$icon$$$setIconQMessageBox::Icon -->
<h3 class="fn" id="icon-prop"><a name="icon-prop"></a><span class="name">icon</span> : <span class="type"><a href="qmessagebox.html#Icon-enum">Icon</a></span></h3>
<p>This property holds the message box's icon</p>
<p>The icon of the message box can be specified with one of the values:</p>
<ul>
<li><a href="qmessagebox.html#Icon-enum">QMessageBox::NoIcon</a></li>
<li><a href="qmessagebox.html#Icon-enum">QMessageBox::Question</a></li>
<li><a href="qmessagebox.html#Icon-enum">QMessageBox::Information</a></li>
<li><a href="qmessagebox.html#Icon-enum">QMessageBox::Warning</a></li>
<li><a href="qmessagebox.html#Icon-enum">QMessageBox::Critical</a></li>
</ul>
<p>The default is <a href="qmessagebox.html#Icon-enum">QMessageBox::NoIcon</a>.</p>
<p>The pixmap used to display the actual icon depends on the current <a href="qwidget.html#style">GUI style</a>. You can also set a custom pixmap for the icon by setting the <a href="qmessagebox.html#iconPixmap-prop">icon pixmap</a> property.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QMessageBox::Icon </td><td class="memItemRight bottomAlign"><span class="name"><b>icon</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setIcon</b></span>(<i>QMessageBox::Icon</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qmessagebox.html#iconPixmap-prop">iconPixmap</a>.</p>
<!-- @@@icon -->
<!-- $$$iconPixmap-prop$$$iconPixmap$$$setIconPixmapconstQPixmap& -->
<h3 class="fn" id="iconPixmap-prop"><a name="iconPixmap-prop"></a><span class="name">iconPixmap</span> : <span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span></h3>
<p>This property holds the current icon</p>
<p>The icon currently used by the message box. Note that it's often hard to draw one pixmap that looks appropriate in all GUI styles; you may want to supply a different pixmap for each platform.</p>
<p>By default, this property is undefined.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QPixmap </td><td class="memItemRight bottomAlign"><span class="name"><b>iconPixmap</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setIconPixmap</b></span>(const QPixmap &amp;<i>pixmap</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="stylesheet-reference.html#icon">icon</a>.</p>
<!-- @@@iconPixmap -->
<!-- $$$informativeText-prop$$$informativeText$$$setInformativeTextconstQString& -->
<h3 class="fn" id="informativeText-prop"><a name="informativeText-prop"></a><span class="name">informativeText</span> : <span class="type"><a href="../qtcore/qstring.html">QString</a></span></h3>
<p>This property holds the informative text that provides a fuller description for the message</p>
<p>Infromative text can be used to expand upon the <a href="qmessagebox.html#text-prop">text</a>() to give more information to the user. On the Mac, this text appears in small system font below the <a href="qmessagebox.html#text-prop">text</a>(). On other platforms, it is simply appended to the existing text.</p>
<p>By default, this property contains an empty string.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>informativeText</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setInformativeText</b></span>(const QString &amp;<i>text</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qmessagebox.html#text-prop">QMessageBox::text</a> and <a href="qmessagebox.html#detailedText-prop">QMessageBox::detailedText</a>.</p>
<!-- @@@informativeText -->
<!-- $$$standardButtons-prop$$$standardButtons$$$setStandardButtonsQMessageBox::StandardButtons -->
<h3 class="fn" id="standardButtons-prop"><a name="standardButtons-prop"></a><span class="name">standardButtons</span> : <span class="type"><a href="qmessagebox.html#StandardButton-enum">StandardButtons</a></span></h3>
<p>collection of standard buttons in the message box</p>
<p>This property controls which standard buttons are used by the message box.</p>
<p>By default, this property contains no standard buttons.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QMessageBox::StandardButtons </td><td class="memItemRight bottomAlign"><span class="name"><b>standardButtons</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setStandardButtons</b></span>(QMessageBox::StandardButtons <i>buttons</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qmessagebox.html#addButton">addButton</a>().</p>
<!-- @@@standardButtons -->
<!-- $$$text-prop$$$text$$$setTextconstQString& -->
<h3 class="fn" id="text-prop"><a name="text-prop"></a><span class="name">text</span> : <span class="type"><a href="../qtcore/qstring.html">QString</a></span></h3>
<p>This property holds the message box text to be displayed.</p>
<p>The text will be interpreted either as a plain text or as rich text, depending on the text format setting (<a href="qmessagebox.html#textFormat-prop">QMessageBox::textFormat</a>). The default setting is <a href="../qtcore/qt.html#TextFormat-enum">Qt::AutoText</a>, i.e&#x2e;, the message box will try to auto-detect the format of the text.</p>
<p>The default value of this property is an empty string.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>text</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setText</b></span>(const QString &amp;<i>text</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qmessagebox.html#textFormat-prop">textFormat</a>, <a href="qmessagebox.html#informativeText-prop">QMessageBox::informativeText</a>, and <a href="qmessagebox.html#detailedText-prop">QMessageBox::detailedText</a>.</p>
<!-- @@@text -->
<!-- $$$textFormat-prop$$$textFormat$$$setTextFormatQt::TextFormat -->
<h3 class="fn" id="textFormat-prop"><a name="textFormat-prop"></a><span class="name">textFormat</span> : <span class="type"><a href="../qtcore/qt.html#TextFormat-enum">Qt::TextFormat</a></span></h3>
<p>This property holds the format of the text displayed by the message box</p>
<p>The current text format used by the message box. See the <a href="../qtcore/qt.html#TextFormat-enum">Qt::TextFormat</a> enum for an explanation of the possible options.</p>
<p>The default format is <a href="../qtcore/qt.html#TextFormat-enum">Qt::AutoText</a>.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::TextFormat </td><td class="memItemRight bottomAlign"><span class="name"><b>textFormat</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setTextFormat</b></span>(Qt::TextFormat <i>format</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qmessagebox.html#text-prop">setText</a>().</p>
<!-- @@@textFormat -->
<!-- $$$textInteractionFlags-prop$$$textInteractionFlags$$$setTextInteractionFlagsQt::TextInteractionFlags -->
<h3 class="fn" id="textInteractionFlags-prop"><a name="textInteractionFlags-prop"></a><span class="name">textInteractionFlags</span> : <span class="type"><a href="../qtcore/qt.html#TextInteractionFlag-enum">Qt::TextInteractionFlags</a></span></h3>
<p>Specifies how the label of the message box should interact with user input.</p>
<p>The default value depends on the style.</p>
<p>This property was introduced in  Qt 5.1.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::TextInteractionFlags </td><td class="memItemRight bottomAlign"><span class="name"><b>textInteractionFlags</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setTextInteractionFlags</b></span>(Qt::TextInteractionFlags <i>flags</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qstyle.html#StyleHint-enum">QStyle::SH_MessageBox_TextInteractionFlags</a>.</p>
<!-- @@@textInteractionFlags -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$ -->

<p>This enum describes the roles that can be used to describe buttons in the button box. Combinations of these roles are as flags used to describe different aspects of their behavior.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>InvalidRole</code></td><td class="topAlign">The button is invalid.</td></tr>
<tr><td class="topAlign"><code>AcceptRole</code></td><td class="topAlign">Clicking the button causes the dialog to be accepted (e.g&#x2e; OK).</td></tr>
<tr><td class="topAlign"><code>RejectRole</code></td><td class="topAlign">Clicking the button causes the dialog to be rejected (e.g&#x2e; Cancel).</td></tr>
<tr><td class="topAlign"><code>DestructiveRole</code></td><td class="topAlign">Clicking the button causes a destructive change (e.g&#x2e; for Discarding Changes) and closes the dialog.</td></tr>
<tr><td class="topAlign"><code>ActionRole</code></td><td class="topAlign">Clicking the button causes changes to the elements within the dialog.</td></tr>
<tr><td class="topAlign"><code>HelpRole</code></td><td class="topAlign">The button can be clicked to request help.</td></tr>
<tr><td class="topAlign"><code>YesRole</code></td><td class="topAlign">The button is a &quot;Yes&quot;-like button.</td></tr>
<tr><td class="topAlign"><code>NoRole</code></td><td class="topAlign">The button is a &quot;No&quot;-like button.</td></tr>
<tr><td class="topAlign"><code>ApplyRole</code></td><td class="topAlign">The button applies current changes.</td></tr>
<tr><td class="topAlign"><code>ResetRole</code></td><td class="topAlign">The button resets the dialog's fields to default values.</td></tr>
</table></div>
<p><b>See also </b><a href="qmessagebox.html#StandardButton-enum">StandardButton</a>.</p>
<!-- @@@ -->
<!-- $$$QMessageBox[overload1]$$$QMessageBoxQWidget* -->
<h3 class="fn" id="QMessageBox"><a name="QMessageBox"></a>QMessageBox::<span class="name">QMessageBox</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a message box with no text and no buttons. <i>parent</i> is passed to the <a href="qdialog.html">QDialog</a> constructor.</p>
<p>On macOS, if you want your message box to appear as a <a href="../qtcore/qt.html#WindowType-enum">Qt::Sheet</a> of its <i>parent</i>, set the message box's <a href="qmessagebox.html#setWindowModality">window modality</a> to <a href="../qtcore/qt.html#WindowModality-enum">Qt::WindowModal</a> or use <a href="qmessagebox.html#open">open</a>(). Otherwise, the message box will be a standard dialog.</p>
<!-- @@@QMessageBox -->
<!-- $$$QMessageBox$$$QMessageBoxQMessageBox::IconconstQString&constQString&QMessageBox::StandardButtonsQWidget*Qt::WindowFlags -->
<h3 class="fn" id="QMessageBox-1"><a name="QMessageBox-1"></a>QMessageBox::<span class="name">QMessageBox</span>(<span class="type"><a href="qmessagebox.html#Icon-enum">QMessageBox::Icon</a></span> <i>icon</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButtons</a></span> <i>buttons</i>, <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = nullptr, <span class="type"><a href="../qtcore/qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>f</i> = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint)</h3>
<p>Constructs a message box with the given <i>icon</i>, <i>title</i>, <i>text</i>, and standard <i>buttons</i>. Standard or custom buttons can be added at any time using <a href="qmessagebox.html#addButton">addButton</a>(). The <i>parent</i> and <i>f</i> arguments are passed to the <a href="qdialog.html">QDialog</a> constructor.</p>
<p>The message box is an <a href="../qtcore/qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p>On macOS, if <i>parent</i> is not 0 and you want your message box to appear as a <a href="../qtcore/qt.html#WindowType-enum">Qt::Sheet</a> of that parent, set the message box's <a href="qmessagebox.html#setWindowModality">window modality</a> to <a href="../qtcore/qt.html#WindowModality-enum">Qt::WindowModal</a> (default). Otherwise, the message box will be a standard dialog.</p>
<p><b>See also </b><a href="qmessagebox.html#setWindowTitle">setWindowTitle</a>(), <a href="qmessagebox.html#text-prop">setText</a>(), <a href="qmessagebox.html#icon-prop">setIcon</a>(), and <a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>().</p>
<!-- @@@QMessageBox -->
<!-- $$$~QMessageBox[overload1]$$$~QMessageBox -->
<h3 class="fn" id="dtor.QMessageBox"><a name="dtor.QMessageBox"></a><code>[virtual] </code>QMessageBox::<span class="name">~QMessageBox</span>()</h3>
<p>Destroys the message box.</p>
<!-- @@@~QMessageBox -->
<!-- $$$about[overload1]$$$aboutQWidget*constQString&constQString& -->
<h3 class="fn" id="about"><a name="about"></a><code>[static] </code><span class="type">void</span> QMessageBox::<span class="name">about</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Displays a simple about box with title <i>title</i> and text <i>text</i>. The about box's parent is <i>parent</i>.</p>
<p>about() looks for a suitable icon in four locations:</p>
<ol class="1" type="1"><li>It prefers <a href="qwidget.html#windowIcon-prop">parent-&gt;icon()</a> if that exists.</li>
<li>If not, it tries the top-level widget containing <i>parent</i>.</li>
<li>If that fails, it tries the <a href="qapplication.html#activeWindow">active window.</a></li>
<li>As a last resort it uses the Information icon.</li>
</ol>
<p>The about box has a single button labelled &quot;OK&quot;. On macOS, the about box is popped up as a modeless window; on other platforms, it is currently application modal.</p>
<p><b>See also </b><a href="qwidget.html#windowIcon-prop">QWidget::windowIcon</a>() and <a href="qapplication.html#activeWindow">QApplication::activeWindow</a>().</p>
<!-- @@@about -->
<!-- $$$aboutQt[overload1]$$$aboutQtQWidget*constQString& -->
<h3 class="fn" id="aboutQt"><a name="aboutQt"></a><code>[static] </code><span class="type">void</span> QMessageBox::<span class="name">aboutQt</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i> = QString())</h3>
<p>Displays a simple message box about Qt, with the given <i>title</i> and centered over <i>parent</i> (if <i>parent</i> is not 0). The message includes the version number of Qt being used by the application.</p>
<p>This is useful for inclusion in the <b>Help</b> menu of an application, as shown in the <a href="qtwidgets-mainwindows-menus-example.html">Menus</a> example.</p>
<p><a href="qapplication.html">QApplication</a> provides this functionality as a slot.</p>
<p>On macOS, the about box is popped up as a modeless window; on other platforms, it is currently application modal.</p>
<p><b>See also </b><a href="qapplication.html#aboutQt">QApplication::aboutQt</a>().</p>
<!-- @@@aboutQt -->
<!-- $$$addButton[overload1]$$$addButtonQAbstractButton*QMessageBox::ButtonRole -->
<h3 class="fn" id="addButton"><a name="addButton"></a><span class="type">void</span> QMessageBox::<span class="name">addButton</span>(<span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *<i>button</i>, <span class="type"><a href="qmessagebox.html#ButtonRole-enum">QMessageBox::ButtonRole</a></span> <i>role</i>)</h3>
<p>Adds the given <i>button</i> to the message box with the specified <i>role</i>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#removeButton">removeButton</a>(), <a href="qmessagebox.html#button">button</a>(), and <a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>().</p>
<!-- @@@addButton -->
<!-- $$$addButton$$$addButtonconstQString&QMessageBox::ButtonRole -->
<h3 class="fn" id="addButton-1"><a name="addButton-1"></a><span class="type"><a href="qpushbutton.html">QPushButton</a></span> *QMessageBox::<span class="name">addButton</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="qmessagebox.html#ButtonRole-enum">QMessageBox::ButtonRole</a></span> <i>role</i>)</h3>
<p>This is an overloaded function.</p>
<p>Creates a button with the given <i>text</i>, adds it to the message box for the specified <i>role</i>, and returns it.</p>
<p>This function was introduced in  Qt 4.2.</p>
<!-- @@@addButton -->
<!-- $$$addButton$$$addButtonQMessageBox::StandardButton -->
<h3 class="fn" id="addButton-2"><a name="addButton-2"></a><span class="type"><a href="qpushbutton.html">QPushButton</a></span> *QMessageBox::<span class="name">addButton</span>(<span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> <i>button</i>)</h3>
<p>This is an overloaded function.</p>
<p>Adds a standard <i>button</i> to the message box if it is valid to do so, and returns the push button.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>().</p>
<!-- @@@addButton -->
<!-- $$$button[overload1]$$$buttonQMessageBox::StandardButton -->
<h3 class="fn" id="button"><a name="button"></a><span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *QMessageBox::<span class="name">button</span>(<span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> <i>which</i>) const</h3>
<p>Returns a pointer corresponding to the standard button <i>which</i>, or 0 if the standard button doesn't exist in this message box.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#standardButtons-prop">standardButtons</a> and <a href="qmessagebox.html#standardButton">standardButton</a>().</p>
<!-- @@@button -->
<!-- $$$buttonClicked[overload1]$$$buttonClickedQAbstractButton* -->
<h3 class="fn" id="buttonClicked"><a name="buttonClicked"></a><code>[signal] </code><span class="type">void</span> QMessageBox::<span class="name">buttonClicked</span>(<span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *<i>button</i>)</h3>
<p>This signal is emitted whenever a button is clicked inside the <a href="qmessagebox.html">QMessageBox</a>. The button that was clicked in returned in <i>button</i>.</p>
<!-- @@@buttonClicked -->
<!-- $$$buttonRole[overload1]$$$buttonRoleQAbstractButton* -->
<h3 class="fn" id="buttonRole"><a name="buttonRole"></a><span class="type"><a href="qmessagebox.html#ButtonRole-enum">QMessageBox::ButtonRole</a></span> QMessageBox::<span class="name">buttonRole</span>(<span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *<i>button</i>) const</h3>
<p>Returns the button role for the specified <i>button</i>. This function returns <a href="qmessagebox.html#ButtonRole-enum">InvalidRole</a> if <i>button</i> is 0 or has not been added to the message box.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qmessagebox.html#buttons">buttons</a>() and <a href="qmessagebox.html#addButton">addButton</a>().</p>
<!-- @@@buttonRole -->
<!-- $$$buttons[overload1]$$$buttons -->
<h3 class="fn" id="buttons"><a name="buttons"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *&gt; QMessageBox::<span class="name">buttons</span>() const</h3>
<p>Returns a list of all the buttons that have been added to the message box.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qmessagebox.html#buttonRole">buttonRole</a>(), <a href="qmessagebox.html#addButton">addButton</a>(), and <a href="qmessagebox.html#removeButton">removeButton</a>().</p>
<!-- @@@buttons -->
<!-- $$$changeEvent[overload1]$$$changeEventQEvent* -->
<h3 class="fn" id="changeEvent"><a name="changeEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMessageBox::<span class="name">changeEvent</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>ev</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget::changeEvent</a>().</p>
<!-- @@@changeEvent -->
<!-- $$$checkBox[overload1]$$$checkBox -->
<h3 class="fn" id="checkBox"><a name="checkBox"></a><span class="type"><a href="qcheckbox.html">QCheckBox</a></span> *QMessageBox::<span class="name">checkBox</span>() const</h3>
<p>Returns the checkbox shown on the dialog. This is 0 if no checkbox is set.</p>
<p>This function was introduced in  Qt 5.2.</p>
<p><b>See also </b><a href="qmessagebox.html#setCheckBox">setCheckBox</a>().</p>
<!-- @@@checkBox -->
<!-- $$$clickedButton[overload1]$$$clickedButton -->
<h3 class="fn" id="clickedButton"><a name="clickedButton"></a><span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *QMessageBox::<span class="name">clickedButton</span>() const</h3>
<p>Returns the button that was clicked by the user, or 0 if the user hit the <b>Esc</b> key and no <a href="qmessagebox.html#setEscapeButton">escape button</a> was set.</p>
<p>If <a href="qmessagebox.html#exec">exec</a>() hasn't been called yet, returns nullptr.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span> messageBox(<span class="keyword">this</span>);
  <span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> <span class="operator">*</span>disconnectButton <span class="operator">=</span>
        messageBox<span class="operator">.</span>addButton(tr(<span class="string">&quot;Disconnect&quot;</span>)<span class="operator">,</span> <span class="type"><a href="qmessagebox.html#QMessageBox">QMessageBox</a></span><span class="operator">::</span>ActionRole);
  <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
  messageBox<span class="operator">.</span>exec();
  <span class="keyword">if</span> (messageBox<span class="operator">.</span>clickedButton() <span class="operator">=</span><span class="operator">=</span> disconnectButton) {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
  }

</pre>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#standardButton">standardButton</a>() and <a href="qmessagebox.html#button">button</a>().</p>
<!-- @@@clickedButton -->
<!-- $$$closeEvent[overload1]$$$closeEventQCloseEvent* -->
<h3 class="fn" id="closeEvent"><a name="closeEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMessageBox::<span class="name">closeEvent</span>(<span class="type"><a href="../qtgui/qcloseevent.html">QCloseEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qdialog.html#closeEvent">QDialog::closeEvent</a>().</p>
<!-- @@@closeEvent -->
<!-- $$$critical[overload1]$$$criticalQWidget*constQString&constQString&QMessageBox::StandardButtonsQMessageBox::StandardButton -->
<h3 class="fn" id="critical"><a name="critical"></a><code>[static] </code><span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> QMessageBox::<span class="name">critical</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButtons</a></span> <i>buttons</i>, <span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> <i>defaultButton</i> = NoButton)</h3>
<p>Opens a critical message box with the given <i>title</i> and <i>text</i> in front of the specified <i>parent</i> widget.</p>
<p>The standard <i>buttons</i> are added to the message box. <i>defaultButton</i> specifies the button used when <b>Enter</b> is pressed. <i>defaultButton</i> must refer to a button that was given in <i>buttons</i>. If <i>defaultButton</i> is <a href="qmessagebox.html#StandardButton-enum">QMessageBox::NoButton</a>, <a href="qmessagebox.html">QMessageBox</a> chooses a suitable default automatically.</p>
<p>Returns the identity of the standard button that was clicked. If <b>Esc</b> was pressed instead, the <a href="qmessagebox.html#default-and-escape-keys">escape button</a> is returned.</p>
<p>The message box is an <a href="../qtcore/qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qmessagebox.html">QMessageBox</a> constructors.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#question">question</a>(), <a href="qmessagebox.html#warning">warning</a>(), and <a href="qmessagebox.html#information">information</a>().</p>
<!-- @@@critical -->
<!-- $$$defaultButton[overload1]$$$defaultButton -->
<h3 class="fn" id="defaultButton"><a name="defaultButton"></a><span class="type"><a href="qpushbutton.html">QPushButton</a></span> *QMessageBox::<span class="name">defaultButton</span>() const</h3>
<p>Returns the button that should be the message box's <a href="qpushbutton.html#default-prop">default button</a>. Returns nullptr if no default button was set.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#setDefaultButton">setDefaultButton</a>(), <a href="qmessagebox.html#addButton">addButton</a>(), and <a href="qpushbutton.html#default-prop">QPushButton::setDefault</a>().</p>
<!-- @@@defaultButton -->
<!-- $$$escapeButton[overload1]$$$escapeButton -->
<h3 class="fn" id="escapeButton"><a name="escapeButton"></a><span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *QMessageBox::<span class="name">escapeButton</span>() const</h3>
<p>Returns the button that is activated when escape is pressed.</p>
<p>By default, <a href="qmessagebox.html">QMessageBox</a> attempts to automatically detect an escape button as follows:</p>
<ol class="1" type="1"><li>If there is only one button, it is made the escape button.</li>
<li>If there is a <a href="qmessagebox.html#StandardButton-enum">Cancel</a> button, it is made the escape button.</li>
<li>On macOS only, if there is exactly one button with the role <a href="qmessagebox.html#ButtonRole-enum">QMessageBox::RejectRole</a>, it is made the escape button.</li>
</ol>
<p>When an escape button could not be automatically detected, pressing <b>Esc</b> has no effect.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#setEscapeButton">setEscapeButton</a>() and <a href="qmessagebox.html#addButton">addButton</a>().</p>
<!-- @@@escapeButton -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn" id="event"><a name="event"></a><code>[override virtual protected] </code><span class="type">bool</span> QMessageBox::<span class="name">event</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#event">QWidget::event</a>().</p>
<!-- @@@event -->
<!-- $$$exec[overload1]$$$exec -->
<h3 class="fn" id="exec"><a name="exec"></a><code>[virtual slot] </code><span class="type">int</span> QMessageBox::<span class="name">exec</span>()</h3>
<p>Reimplemented from <a href="qdialog.html#exec">QDialog::exec</a>().</p>
<p>Shows the message box as a <a href="qdialog.html#modal-dialogs">modal dialog</a>, blocking until the user closes it.</p>
<p>When using a <a href="qmessagebox.html">QMessageBox</a> with standard buttons, this function returns a <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> value indicating the standard button that was clicked. When using <a href="qmessagebox.html">QMessageBox</a> with custom buttons, this function returns an opaque value; use <a href="qmessagebox.html#clickedButton">clickedButton</a>() to determine which button was clicked.</p>
<p><b>Note: </b>The <a href="qdialog.html#result">result</a>() function returns also <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> value instead of <a href="qdialog.html#DialogCode-enum">QDialog::DialogCode</a>.</p><p>Users cannot interact with any other window in the same application until they close the dialog, either by clicking a button or by using a mechanism provided by the window system.</p>
<p><b>See also </b><a href="qwidget.html#show">show</a>() and <a href="qdialog.html#result">result</a>().</p>
<!-- @@@exec -->
<!-- $$$information[overload1]$$$informationQWidget*constQString&constQString&QMessageBox::StandardButtonsQMessageBox::StandardButton -->
<h3 class="fn" id="information"><a name="information"></a><code>[static] </code><span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> QMessageBox::<span class="name">information</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButtons</a></span> <i>buttons</i>, <span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> <i>defaultButton</i> = NoButton)</h3>
<p>Opens an information message box with the given <i>title</i> and <i>text</i> in front of the specified <i>parent</i> widget.</p>
<p>The standard <i>buttons</i> are added to the message box. <i>defaultButton</i> specifies the button used when <b>Enter</b> is pressed. <i>defaultButton</i> must refer to a button that was given in <i>buttons</i>. If <i>defaultButton</i> is <a href="qmessagebox.html#StandardButton-enum">QMessageBox::NoButton</a>, <a href="qmessagebox.html">QMessageBox</a> chooses a suitable default automatically.</p>
<p>Returns the identity of the standard button that was clicked. If <b>Esc</b> was pressed instead, the <a href="qmessagebox.html#default-and-escape-keys">escape button</a> is returned.</p>
<p>The message box is an <a href="../qtcore/qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qmessagebox.html">QMessageBox</a> constructors.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#question">question</a>(), <a href="qmessagebox.html#warning">warning</a>(), and <a href="qmessagebox.html#critical">critical</a>().</p>
<!-- @@@information -->
<!-- $$$keyPressEvent[overload1]$$$keyPressEventQKeyEvent* -->
<h3 class="fn" id="keyPressEvent"><a name="keyPressEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMessageBox::<span class="name">keyPressEvent</span>(<span class="type"><a href="../qtgui/qkeyevent.html">QKeyEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qdialog.html#keyPressEvent">QDialog::keyPressEvent</a>().</p>
<!-- @@@keyPressEvent -->
<!-- $$$open[overload1]$$$openQObject*constchar* -->
<h3 class="fn" id="open"><a name="open"></a><span class="type">void</span> QMessageBox::<span class="name">open</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>receiver</i>, const <span class="type">char</span> *<i>member</i>)</h3>
<p>Opens the dialog and connects its <a href="qdialog.html#finished">finished</a>() or <a href="qmessagebox.html#buttonClicked">buttonClicked</a>() signal to the slot specified by <i>receiver</i> and <i>member</i>. If the slot in <i>member</i> has a pointer for its first parameter the connection is to <a href="qmessagebox.html#buttonClicked">buttonClicked</a>(), otherwise the connection is to <a href="qdialog.html#finished">finished</a>().</p>
<p>The signal will be disconnected from the slot when the dialog is closed.</p>
<!-- @@@open -->
<!-- $$$question[overload1]$$$questionQWidget*constQString&constQString&QMessageBox::StandardButtonsQMessageBox::StandardButton -->
<h3 class="fn" id="question"><a name="question"></a><code>[static] </code><span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> QMessageBox::<span class="name">question</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButtons</a></span> <i>buttons</i> = ..., <span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> <i>defaultButton</i> = NoButton)</h3>
<p>Opens a question message box with the given <i>title</i> and <i>text</i> in front of the specified <i>parent</i> widget.</p>
<p>The standard <i>buttons</i> are added to the message box. <i>defaultButton</i> specifies the button used when <b>Enter</b> is pressed. <i>defaultButton</i> must refer to a button that was given in <i>buttons</i>. If <i>defaultButton</i> is <a href="qmessagebox.html#StandardButton-enum">QMessageBox::NoButton</a>, <a href="qmessagebox.html">QMessageBox</a> chooses a suitable default automatically.</p>
<p>Returns the identity of the standard button that was clicked. If <b>Esc</b> was pressed instead, the <a href="qmessagebox.html#default-and-escape-keys">escape button</a> is returned.</p>
<p>The message box is an <a href="../qtcore/qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qmessagebox.html">QMessageBox</a> constructors.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#information">information</a>(), <a href="qmessagebox.html#warning">warning</a>(), and <a href="qmessagebox.html#critical">critical</a>().</p>
<!-- @@@question -->
<!-- $$$removeButton[overload1]$$$removeButtonQAbstractButton* -->
<h3 class="fn" id="removeButton"><a name="removeButton"></a><span class="type">void</span> QMessageBox::<span class="name">removeButton</span>(<span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *<i>button</i>)</h3>
<p>Removes <i>button</i> from the button box without deleting it.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#addButton">addButton</a>() and <a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>().</p>
<!-- @@@removeButton -->
<!-- $$$resizeEvent[overload1]$$$resizeEventQResizeEvent* -->
<h3 class="fn" id="resizeEvent"><a name="resizeEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMessageBox::<span class="name">resizeEvent</span>(<span class="type"><a href="../qtgui/qresizeevent.html">QResizeEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qdialog.html#resizeEvent">QDialog::resizeEvent</a>().</p>
<!-- @@@resizeEvent -->
<!-- $$$setCheckBox[overload1]$$$setCheckBoxQCheckBox* -->
<h3 class="fn" id="setCheckBox"><a name="setCheckBox"></a><span class="type">void</span> QMessageBox::<span class="name">setCheckBox</span>(<span class="type"><a href="qcheckbox.html">QCheckBox</a></span> *<i>cb</i>)</h3>
<p>Sets the checkbox <i>cb</i> on the message dialog. The message box takes ownership of the checkbox. The argument <i>cb</i> can be 0 to remove an existing checkbox from the message box.</p>
<p>This function was introduced in  Qt 5.2.</p>
<p><b>See also </b><a href="qmessagebox.html#checkBox">checkBox</a>().</p>
<!-- @@@setCheckBox -->
<!-- $$$setDefaultButton[overload1]$$$setDefaultButtonQPushButton* -->
<h3 class="fn" id="setDefaultButton"><a name="setDefaultButton"></a><span class="type">void</span> QMessageBox::<span class="name">setDefaultButton</span>(<span class="type"><a href="qpushbutton.html">QPushButton</a></span> *<i>button</i>)</h3>
<p>Sets the message box's <a href="qpushbutton.html#default-prop">default button</a> to <i>button</i>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#defaultButton">defaultButton</a>(), <a href="qmessagebox.html#addButton">addButton</a>(), and <a href="qpushbutton.html#default-prop">QPushButton::setDefault</a>().</p>
<!-- @@@setDefaultButton -->
<!-- $$$setDefaultButton$$$setDefaultButtonQMessageBox::StandardButton -->
<h3 class="fn" id="setDefaultButton-1"><a name="setDefaultButton-1"></a><span class="type">void</span> QMessageBox::<span class="name">setDefaultButton</span>(<span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> <i>button</i>)</h3>
<p>Sets the message box's <a href="qpushbutton.html#default-prop">default button</a> to <i>button</i>.</p>
<p>This function was introduced in  Qt 4.3.</p>
<p><b>See also </b><a href="qmessagebox.html#addButton">addButton</a>() and <a href="qpushbutton.html#default-prop">QPushButton::setDefault</a>().</p>
<!-- @@@setDefaultButton -->
<!-- $$$setEscapeButton[overload1]$$$setEscapeButtonQAbstractButton* -->
<h3 class="fn" id="setEscapeButton"><a name="setEscapeButton"></a><span class="type">void</span> QMessageBox::<span class="name">setEscapeButton</span>(<span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *<i>button</i>)</h3>
<p>Sets the button that gets activated when the <b>Escape</b> key is pressed to <i>button</i>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#escapeButton">escapeButton</a>(), <a href="qmessagebox.html#addButton">addButton</a>(), and <a href="qmessagebox.html#clickedButton">clickedButton</a>().</p>
<!-- @@@setEscapeButton -->
<!-- $$$setEscapeButton$$$setEscapeButtonQMessageBox::StandardButton -->
<h3 class="fn" id="setEscapeButton-1"><a name="setEscapeButton-1"></a><span class="type">void</span> QMessageBox::<span class="name">setEscapeButton</span>(<span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> <i>button</i>)</h3>
<p>Sets the buttons that gets activated when the <b>Escape</b> key is pressed to <i>button</i>.</p>
<p>This function was introduced in  Qt 4.3.</p>
<p><b>See also </b><a href="qmessagebox.html#addButton">addButton</a>() and <a href="qmessagebox.html#clickedButton">clickedButton</a>().</p>
<!-- @@@setEscapeButton -->
<!-- $$$setWindowModality[overload1]$$$setWindowModalityQt::WindowModality -->
<h3 class="fn" id="setWindowModality"><a name="setWindowModality"></a><span class="type">void</span> QMessageBox::<span class="name">setWindowModality</span>(<span class="type"><a href="../qtcore/qt.html#WindowModality-enum">Qt::WindowModality</a></span> <i>windowModality</i>)</h3>
<p>This function shadows <a href="qwidget.html#windowModality-prop">QWidget::setWindowModality</a>().</p>
<p>Sets the modality of the message box to <i>windowModality</i>.</p>
<p>On macOS, if the modality is set to <a href="../qtcore/qt.html#WindowModality-enum">Qt::WindowModal</a> and the message box has a parent, then the message box will be a <a href="../qtcore/qt.html#WindowType-enum">Qt::Sheet</a>, otherwise the message box will be a standard dialog.</p>
<p>This function was introduced in  Qt 4.2.</p>
<!-- @@@setWindowModality -->
<!-- $$$setWindowTitle[overload1]$$$setWindowTitleconstQString& -->
<h3 class="fn" id="setWindowTitle"><a name="setWindowTitle"></a><span class="type">void</span> QMessageBox::<span class="name">setWindowTitle</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>)</h3>
<p>This function shadows <a href="qwidget.html#windowTitle-prop">QWidget::setWindowTitle</a>().</p>
<p>Sets the title of the message box to <i>title</i>. On macOS, the window title is ignored (as required by the macOS Guidelines).</p>
<p>This function was introduced in  Qt 4.2.</p>
<!-- @@@setWindowTitle -->
<!-- $$$showEvent[overload1]$$$showEventQShowEvent* -->
<h3 class="fn" id="showEvent"><a name="showEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QMessageBox::<span class="name">showEvent</span>(<span class="type"><a href="../qtgui/qshowevent.html">QShowEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qdialog.html#showEvent">QDialog::showEvent</a>().</p>
<!-- @@@showEvent -->
<!-- $$$standardButton[overload1]$$$standardButtonQAbstractButton* -->
<h3 class="fn" id="standardButton"><a name="standardButton"></a><span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> QMessageBox::<span class="name">standardButton</span>(<span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> *<i>button</i>) const</h3>
<p>Returns the standard button enum value corresponding to the given <i>button</i>, or <a href="qmessagebox.html#StandardButton-enum">NoButton</a> if the given <i>button</i> isn't a standard button.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#button">button</a>() and <a href="qmessagebox.html#standardButtons-prop">standardButtons</a>().</p>
<!-- @@@standardButton -->
<!-- $$$warning[overload1]$$$warningQWidget*constQString&constQString&QMessageBox::StandardButtonsQMessageBox::StandardButton -->
<h3 class="fn" id="warning"><a name="warning"></a><code>[static] </code><span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> QMessageBox::<span class="name">warning</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButtons</a></span> <i>buttons</i>, <span class="type"><a href="qmessagebox.html#StandardButton-enum">QMessageBox::StandardButton</a></span> <i>defaultButton</i> = NoButton)</h3>
<p>Opens a warning message box with the given <i>title</i> and <i>text</i> in front of the specified <i>parent</i> widget.</p>
<p>The standard <i>buttons</i> are added to the message box. <i>defaultButton</i> specifies the button used when <b>Enter</b> is pressed. <i>defaultButton</i> must refer to a button that was given in <i>buttons</i>. If <i>defaultButton</i> is <a href="qmessagebox.html#StandardButton-enum">QMessageBox::NoButton</a>, <a href="qmessagebox.html">QMessageBox</a> chooses a suitable default automatically.</p>
<p>Returns the identity of the standard button that was clicked. If <b>Esc</b> was pressed instead, the <a href="qmessagebox.html#default-and-escape-keys">escape button</a> is returned.</p>
<p>The message box is an <a href="../qtcore/qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qmessagebox.html">QMessageBox</a> constructors.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qmessagebox.html#question">question</a>(), <a href="qmessagebox.html#information">information</a>(), and <a href="qmessagebox.html#critical">critical</a>().</p>
<!-- @@@warning -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>