Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 862

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QMessageBox Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QMessageBox Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QMessageBox 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>

<p>Inherits <a href="qdialog.html">QDialog</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a></b> { InvalidRole, AcceptRole, RejectRole, DestructiveRole, ..., ApplyRole }</li><li><div class="fn" />enum <b><a href="qmessagebox.html#Icon-enum">Icon</a></b> { NoIcon, Information, Warning, Critical, Question }</li><li><div class="fn" />enum <b><a href="qmessagebox.html#StandardButton-enum">StandardButton</a></b> { NoButton, Ok, Save, SaveAll, ..., ButtonMask }</li><li><div class="fn" />class <b><a href="qmessagebox-standardbuttons.html">StandardButtons</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qmessagebox.html#QMessageBox">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qmessagebox.html#QMessageBox-2">__init__</a></b> (<i>self</i>, Icon&#160;<i>icon</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, StandardButtons&#160;<i>buttons</i>&#160;=&#160;QMessageBox.NoButton, QWidget&#160;<i>parent</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)</li><li><div class="fn" /><b><a href="qmessagebox.html#QMessageBox-3">__init__</a></b> (<i>self</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, Icon&#160;<i>icon</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>, int&#160;<i>button2</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)</li><li><div class="fn" /><b><a href="qmessagebox.html#addButton">addButton</a></b> (<i>self</i>, QAbstractButton&#160;<i>button</i>, ButtonRole&#160;<i>role</i>)</li><li><div class="fn" />QPushButton <b><a href="qmessagebox.html#addButton-2">addButton</a></b> (<i>self</i>, QString&#160;<i>text</i>, ButtonRole&#160;<i>role</i>)</li><li><div class="fn" />QPushButton <b><a href="qmessagebox.html#addButton-3">addButton</a></b> (<i>self</i>, StandardButton&#160;<i>button</i>)</li><li><div class="fn" />QAbstractButton <b><a href="qmessagebox.html#button">button</a></b> (<i>self</i>, StandardButton&#160;<i>which</i>)</li><li><div class="fn" />ButtonRole <b><a href="qmessagebox.html#buttonRole">buttonRole</a></b> (<i>self</i>, QAbstractButton&#160;<i>button</i>)</li><li><div class="fn" />list-of-QAbstractButton <b><a href="qmessagebox.html#buttons">buttons</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qmessagebox.html#buttonText">buttonText</a></b> (<i>self</i>, int&#160;<i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />QAbstractButton <b><a href="qmessagebox.html#clickedButton">clickedButton</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#closeEvent">closeEvent</a></b> (<i>self</i>, QCloseEvent)</li><li><div class="fn" />QPushButton <b><a href="qmessagebox.html#defaultButton">defaultButton</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qmessagebox.html#detailedText">detailedText</a></b> (<i>self</i>)</li><li><div class="fn" />QAbstractButton <b><a href="qmessagebox.html#escapeButton">escapeButton</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmessagebox.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />Icon <b><a href="qmessagebox.html#icon">icon</a></b> (<i>self</i>)</li><li><div class="fn" />QPixmap <b><a href="qmessagebox.html#iconPixmap">iconPixmap</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qmessagebox.html#informativeText">informativeText</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent)</li><li><div class="fn" /><b><a href="qmessagebox.html#open">open</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#open-2">open</a></b> (<i>self</i>, QObject&#160;<i>receiver</i>, SLOT()SLOT()&#160;<i>member</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#open-3">open</a></b> (<i>self</i>, callable&#160;<i>receiver</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#removeButton">removeButton</a></b> (<i>self</i>, QAbstractButton&#160;<i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qmessagebox.html#setButtonText">setButtonText</a></b> (<i>self</i>, int&#160;<i>button</i>, QString)</li><li><div class="fn" /><b><a href="qmessagebox.html#setDefaultButton">setDefaultButton</a></b> (<i>self</i>, QPushButton&#160;<i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setDefaultButton-2">setDefaultButton</a></b> (<i>self</i>, StandardButton&#160;<i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setDetailedText">setDetailedText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setEscapeButton">setEscapeButton</a></b> (<i>self</i>, QAbstractButton&#160;<i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setEscapeButton-2">setEscapeButton</a></b> (<i>self</i>, StandardButton&#160;<i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setIcon">setIcon</a></b> (<i>self</i>, Icon)</li><li><div class="fn" /><b><a href="qmessagebox.html#setIconPixmap">setIconPixmap</a></b> (<i>self</i>, QPixmap)</li><li><div class="fn" /><b><a href="qmessagebox.html#setInformativeText">setInformativeText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setStandardButtons">setStandardButtons</a></b> (<i>self</i>, StandardButtons&#160;<i>buttons</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setText">setText</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qmessagebox.html#setTextFormat">setTextFormat</a></b> (<i>self</i>, Qt.TextFormat)</li><li><div class="fn" /><b><a href="qmessagebox.html#setWindowModality">setWindowModality</a></b> (<i>self</i>, Qt.WindowModality&#160;<i>windowModality</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setWindowTitle">setWindowTitle</a></b> (<i>self</i>, QString&#160;<i>title</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#showEvent">showEvent</a></b> (<i>self</i>, QShowEvent)</li><li><div class="fn" />QSize <b><a href="qmessagebox.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#standardButton">standardButton</a></b> (<i>self</i>, QAbstractButton&#160;<i>button</i>)</li><li><div class="fn" />StandardButtons <b><a href="qmessagebox.html#standardButtons">standardButtons</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qmessagebox.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.TextFormat <b><a href="qmessagebox.html#textFormat">textFormat</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" /><b><a href="qmessagebox.html#about">about</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>caption</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#aboutQt">aboutQt</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>&#160;=&#160;QString())</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#critical">critical</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, StandardButtons&#160;<i>buttons</i>&#160;=&#160;QMessageBox.Ok, StandardButton&#160;<i>defaultButton</i>&#160;=&#160;QMessageBox.NoButton)</li><li><div class="fn" />int <b><a href="qmessagebox.html#critical-2">critical</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>, int&#160;<i>button2</i>&#160;=&#160;0)</li><li><div class="fn" />int <b><a href="qmessagebox.html#critical-3">critical</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, QString&#160;<i>button0Text</i>, QString&#160;<i>button1Text</i>&#160;=&#160;QString(), QString&#160;<i>button2Text</i>&#160;=&#160;QString(), int&#160;<i>defaultButtonNumber</i>&#160;=&#160;0, int&#160;<i>escapeButtonNumber</i>&#160;=&#160;-1)</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#information">information</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, StandardButtons&#160;<i>buttons</i>&#160;=&#160;QMessageBox.Ok, StandardButton&#160;<i>defaultButton</i>&#160;=&#160;QMessageBox.NoButton)</li><li><div class="fn" />int <b><a href="qmessagebox.html#information-2">information</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>&#160;=&#160;0, int&#160;<i>button2</i>&#160;=&#160;0)</li><li><div class="fn" />int <b><a href="qmessagebox.html#information-3">information</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, QString&#160;<i>button0Text</i>, QString&#160;<i>button1Text</i>&#160;=&#160;QString(), QString&#160;<i>button2Text</i>&#160;=&#160;QString(), int&#160;<i>defaultButtonNumber</i>&#160;=&#160;0, int&#160;<i>escapeButtonNumber</i>&#160;=&#160;-1)</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#question">question</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, StandardButtons&#160;<i>buttons</i>&#160;=&#160;QMessageBox.Ok, StandardButton&#160;<i>defaultButton</i>&#160;=&#160;QMessageBox.NoButton)</li><li><div class="fn" />int <b><a href="qmessagebox.html#question-2">question</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>&#160;=&#160;0, int&#160;<i>button2</i>&#160;=&#160;0)</li><li><div class="fn" />int <b><a href="qmessagebox.html#question-3">question</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, QString&#160;<i>button0Text</i>, QString&#160;<i>button1Text</i>&#160;=&#160;QString(), QString&#160;<i>button2Text</i>&#160;=&#160;QString(), int&#160;<i>defaultButtonNumber</i>&#160;=&#160;0, int&#160;<i>escapeButtonNumber</i>&#160;=&#160;-1)</li><li><div class="fn" />QPixmap <b><a href="qmessagebox.html#standardIcon">standardIcon</a></b> (Icon&#160;<i>icon</i>)</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#warning">warning</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, StandardButtons&#160;<i>buttons</i>&#160;=&#160;QMessageBox.Ok, StandardButton&#160;<i>defaultButton</i>&#160;=&#160;QMessageBox.NoButton)</li><li><div class="fn" />int <b><a href="qmessagebox.html#warning-2">warning</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>, int&#160;<i>button2</i>&#160;=&#160;0)</li><li><div class="fn" />int <b><a href="qmessagebox.html#warning-3">warning</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, QString&#160;<i>button0Text</i>, QString&#160;<i>button1Text</i>&#160;=&#160;QString(), QString&#160;<i>button2Text</i>&#160;=&#160;QString(), int&#160;<i>defaultButtonNumber</i>&#160;=&#160;0, int&#160;<i>escapeButtonNumber</i>&#160;=&#160;-1)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qmessagebox.html#buttonClicked">buttonClicked</a></b> (QAbstractButton *)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QMessageBox 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 QMessageBox 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 id="the-property-based-api" name="the-property-based-api" />
<h3>The Property-based API</h3>
<p>To use the property-based API, construct an instance of
QMessageBox, 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">QMessageBox</span> msgBox;
 msgBox<span class="operator">.</span><a href="qmessagebox.html#text-prop">setText</a>(<span class="string">"The document has been modified."</span>);
 msgBox<span class="operator">.</span><a href="qmessagebox.html#exec">exec_</a>();
</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 alt="" src="images/msgbox1.png" /></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">QMessageBox</span> msgBox;
 msgBox<span class="operator">.</span><a href="qmessagebox.html#text-prop">setText</a>(<span class="string">"The document has been modified."</span>);
 msgBox<span class="operator">.</span><a href="qmessagebox.html#informativeText-prop">setInformativeText</a>(<span class="string">"Do you want to save your changes?"</span>);
 msgBox<span class="operator">.</span><a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>(<span class="type">QMessageBox</span><span class="operator">.</span>Save <span class="operator">|</span> <span class="type">QMessageBox</span><span class="operator">.</span>Discard <span class="operator">|</span> <span class="type">QMessageBox</span><span class="operator">.</span>Cancel);
 msgBox<span class="operator">.</span><a href="qmessagebox.html#setDefaultButton">setDefaultButton</a>(<span class="type">QMessageBox</span><span class="operator">.</span>Save);
 <span class="type">int</span> ret <span class="operator">=</span> msgBox<span class="operator">.</span><a href="qmessagebox.html#exec">exec_</a>();
</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">
Mac OS X 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 alt="" src="images/msgbox2.png" /></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">QMessageBox</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">QMessageBox</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">QMessageBox</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...</b> button will be
shown.</p>
<p class="centerAlign"><img alt="" src="images/msgbox3.png" /></p>
<p>Clicking the <b>Show Details...</b> button displays the detailed
text.</p>
<p class="centerAlign"><img alt="" src="images/msgbox4.png" /></p>
<a id="rich-text-and-the-text-format-property" name="rich-text-and-the-text-format-property" />
<h4>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="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="qt.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="qt.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 id="severity-levels-and-the-icon-and-pixmap-properties" name="severity-levels-and-the-icon-and-pixmap-properties" />
<h4>Severity Levels and the Icon and Pixmap Properties</h4>
<p>QMessageBox 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>
<table class="generic">
<tr class="odd" valign="top">
<td>
<p class="centerAlign"><img alt="" src="images/qmessagebox-quest.png" /></p>
</td>
<td><a href="qmessagebox.html#Icon-enum">Question</a></td>
<td>For asking a question during normal operations.</td>
</tr>
<tr class="even" valign="top">
<td>
<p class="centerAlign"><img alt="" src="images/qmessagebox-info.png" /></p>
</td>
<td><a href="qmessagebox.html#Icon-enum">Information</a></td>
<td>For reporting information about normal operations.</td>
</tr>
<tr class="odd" valign="top">
<td>
<p class="centerAlign"><img alt="" src="images/qmessagebox-warn.png" /></p>
</td>
<td><a href="qmessagebox.html#Icon-enum">Warning</a></td>
<td>For reporting non-critical errors.</td>
</tr>
<tr class="even" valign="top">
<td>
<p class="centerAlign"><img alt="" src="images/qmessagebox-crit.png" /></p>
</td>
<td><a href="qmessagebox.html#Icon-enum">Critical</a></td>
<td>For reporting critical errors.</td>
</tr>
</table>
<p><a href="qmessagebox.html#Icon-enum">Predefined icons</a> are
not defined by QMessageBox, 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 id="the-static-functions-api" name="the-static-functions-api" />
<h3>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
<tt>title</tt> parameter as the message box main text and the
<tt>text</tt> 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="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
<tt>text</tt> 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">QMessageBox</span><span class="operator">.</span><a href="qmessagebox.html#warning">warning</a>(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"My Application"</span>)<span class="operator">,</span>
                                tr(<span class="string">"The document has been modified.\n"</span>
                                   <span class="string">"Do you want to save your changes?"</span>)<span class="operator">,</span>
                                <span class="type">QMessageBox</span><span class="operator">.</span>Save <span class="operator">|</span> <span class="type">QMessageBox</span><span class="operator">.</span>Discard
                                <span class="operator">|</span> <span class="type">QMessageBox</span><span class="operator">.</span>Cancel<span class="operator">,</span>
                                <span class="type">QMessageBox</span><span class="operator">.</span>Save);
</pre>
<p>The <a href="dialogs-standarddialogs.html">Standard Dialogs</a>
example shows how to use QMessageBox and the other built-in Qt
dialogs.</p>
<a id="advanced-usage" name="advanced-usage" />
<h3>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 ButtonRoleto to add custom
buttons. The <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> is used by
QMessageBox 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">QMessageBox</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><a href="qmessagebox.html#addButton">addButton</a>(tr(<span class="string">"Connect"</span>)<span class="operator">,</span> <span class="type">QMessageBox</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><a href="qmessagebox.html#addButton">addButton</a>(<span class="type">QMessageBox</span><span class="operator">.</span>Abort);

 msgBox<span class="operator">.</span><a href="qmessagebox.html#exec">exec_</a>();

 <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 id="default-and-escape-keys" name="default-and-escape-keys" />
<h3>Default and Escape Keys</h3>
<p>The default button (i.e., 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, QMessageBox 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, QMessageBox tries to find one using
these rules:</p>
<ol class="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>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ButtonRole-enum" />QMessageBox.ButtonRole</h3><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>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.InvalidRole</tt></td>
<td class="topAlign"><tt>-1</tt></td>
<td class="topAlign">The button is invalid.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.AcceptRole</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Clicking the button causes the dialog to be
accepted (e.g. OK).</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.RejectRole</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Clicking the button causes the dialog to be
rejected (e.g. Cancel).</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.DestructiveRole</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">Clicking the button causes a destructive
change (e.g. for Discarding Changes) and closes the dialog.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.ActionRole</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">Clicking the button causes changes to the
elements within the dialog.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.HelpRole</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">The button can be clicked to request
help.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.YesRole</tt></td>
<td class="topAlign"><tt>5</tt></td>
<td class="topAlign">The button is a "Yes"-like button.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoRole</tt></td>
<td class="topAlign"><tt>6</tt></td>
<td class="topAlign">The button is a "No"-like button.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.ApplyRole</tt></td>
<td class="topAlign"><tt>8</tt></td>
<td class="topAlign">The button applies current changes.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.ResetRole</tt></td>
<td class="topAlign"><tt>7</tt></td>
<td class="topAlign">The button resets the dialog's fields to
default values.</td>
</tr>
</table>
<p><b>See also</b> <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>.</p>


<h3 class="fn"><a name="Icon-enum" />QMessageBox.Icon</h3><p>This enum has the following values:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoIcon</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">the message box does not have any icon.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Question</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">an icon indicating that the message is asking
a question.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Information</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">an icon indicating that the message is nothing
out of the ordinary.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Warning</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">an icon indicating that the message is a
warning, but can be dealt with.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Critical</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">an icon indicating that the message represents
a critical problem.</td>
</tr>
</table>


<h3 class="fn"><a name="StandardButton-enum" />QMessageBox.StandardButton</h3><p>These enums describe flags for standard buttons. Each button has
a defined <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a>.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Ok</tt></td>
<td class="topAlign"><tt>0x00000400</tt></td>
<td class="topAlign">An "OK" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Open</tt></td>
<td class="topAlign"><tt>0x00002000</tt></td>
<td class="topAlign">A "Open" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Save</tt></td>
<td class="topAlign"><tt>0x00000800</tt></td>
<td class="topAlign">A "Save" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Cancel</tt></td>
<td class="topAlign"><tt>0x00400000</tt></td>
<td class="topAlign">A "Cancel" button defined with the <a href="qmessagebox.html#ButtonRole-enum">RejectRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Close</tt></td>
<td class="topAlign"><tt>0x00200000</tt></td>
<td class="topAlign">A "Close" button defined with the <a href="qmessagebox.html#ButtonRole-enum">RejectRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Discard</tt></td>
<td class="topAlign"><tt>0x00800000</tt></td>
<td class="topAlign">A "Discard" or "Don't Save" button, depending
on the platform, defined with the <a href="qmessagebox.html#ButtonRole-enum">DestructiveRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Apply</tt></td>
<td class="topAlign"><tt>0x02000000</tt></td>
<td class="topAlign">An "Apply" button defined with the <a href="qmessagebox.html#ButtonRole-enum">ApplyRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Reset</tt></td>
<td class="topAlign"><tt>0x04000000</tt></td>
<td class="topAlign">A "Reset" button defined with the <a href="qmessagebox.html#ButtonRole-enum">ResetRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.RestoreDefaults</tt></td>
<td class="topAlign"><tt>0x08000000</tt></td>
<td class="topAlign">A "Restore Defaults" button defined with the
<a href="qmessagebox.html#ButtonRole-enum">ResetRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Help</tt></td>
<td class="topAlign"><tt>0x01000000</tt></td>
<td class="topAlign">A "Help" button defined with the <a href="qmessagebox.html#ButtonRole-enum">HelpRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.SaveAll</tt></td>
<td class="topAlign"><tt>0x00001000</tt></td>
<td class="topAlign">A "Save All" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Yes</tt></td>
<td class="topAlign"><tt>0x00004000</tt></td>
<td class="topAlign">A "Yes" button defined with the <a href="qmessagebox.html#ButtonRole-enum">YesRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.YesToAll</tt></td>
<td class="topAlign"><tt>0x00008000</tt></td>
<td class="topAlign">A "Yes to All" button defined with the
<a href="qmessagebox.html#ButtonRole-enum">YesRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.No</tt></td>
<td class="topAlign"><tt>0x00010000</tt></td>
<td class="topAlign">A "No" button defined with the <a href="qmessagebox.html#ButtonRole-enum">NoRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoToAll</tt></td>
<td class="topAlign"><tt>0x00020000</tt></td>
<td class="topAlign">A "No to All" button defined with the <a href="qmessagebox.html#ButtonRole-enum">NoRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Abort</tt></td>
<td class="topAlign"><tt>0x00040000</tt></td>
<td class="topAlign">An "Abort" button defined with the <a href="qmessagebox.html#ButtonRole-enum">RejectRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Retry</tt></td>
<td class="topAlign"><tt>0x00080000</tt></td>
<td class="topAlign">A "Retry" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Ignore</tt></td>
<td class="topAlign"><tt>0x00100000</tt></td>
<td class="topAlign">An "Ignore" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoButton</tt></td>
<td class="topAlign"><tt>0x00000000</tt></td>
<td class="topAlign">An invalid button.</td>
</tr>
</table>
<p>The following values are obsolete:</p>
<table class="valuelist">
<tr class="even" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.YesAll</tt></td>
<td class="topAlign"><tt>YesToAll</tt></td>
<td class="topAlign">Use YesToAll instead.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoAll</tt></td>
<td class="topAlign"><tt>NoToAll</tt></td>
<td class="topAlign">Use NoToAll instead.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Default</tt></td>
<td class="topAlign"><tt>0x00000100</tt></td>
<td class="topAlign">Use the <tt>defaultButton</tt> 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"><tt>QMessageBox.Escape</tt></td>
<td class="topAlign"><tt>0x00000200</tt></td>
<td class="topAlign">Call <a href="qmessagebox.html#setEscapeButton">setEscapeButton</a>()
instead.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.FlagMask</tt></td>
<td class="topAlign"><tt>0x00000300</tt></td>
<td class="topAlign">&#160;</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.ButtonMask</tt></td>
<td class="topAlign"><tt>~FlagMask</tt></td>
<td class="topAlign">&#160;</td>
</tr>
</table>
<p>This enum was introduced or modified in Qt 4.2.</p>
<p>The StandardButtons type is a typedef for <a href="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>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QMessageBox" />QMessageBox.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><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 Mac OS X, if you want your message box to appear as a
<a href="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="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>


<h3 class="fn"><a name="QMessageBox-2" />QMessageBox.__init__ (<i>self</i>, <a href="qmessagebox.html#Icon-enum">Icon</a>&#160;<i>icon</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a>&#160;<i>buttons</i>&#160;=&#160;QMessageBox.NoButton, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><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="qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p>On Mac OS X, if <i>parent</i> is not 0 and you want your message
box to appear as a <a href="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="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>


<h3 class="fn"><a name="QMessageBox-3" />QMessageBox.__init__ (<i>self</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, <a href="qmessagebox.html#Icon-enum">Icon</a>&#160;<i>icon</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>, int&#160;<i>button2</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><h3 class="fn"><a name="about" />QMessageBox.about (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>caption</i>, QString&#160;<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">
<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 "OK". On Mac OS X,
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>


<h3 class="fn"><a name="aboutQt" />QMessageBox.aboutQt (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>&#160;=&#160;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="mainwindows-menus.html">Menus</a> example.</p>
<p><a href="qapplication.html">QApplication</a> provides this
functionality as a slot.</p>
<p>On Mac OS X, 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>


<h3 class="fn"><a name="addButton" />QMessageBox.addButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a>&#160;<i>button</i>, <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a>&#160;<i>role</i>)</h3><p>The <i>button</i> argument has it's ownership transferred to Qt.</p><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>


<h3 class="fn"><a name="addButton-2" /><a href="qpushbutton.html">QPushButton</a> QMessageBox.addButton (<i>self</i>, QString&#160;<i>text</i>, <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a>&#160;<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>


<h3 class="fn"><a name="addButton-3" /><a href="qpushbutton.html">QPushButton</a> QMessageBox.addButton (<i>self</i>, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>&#160;<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>


<h3 class="fn"><a name="button" /><a href="qabstractbutton.html">QAbstractButton</a> QMessageBox.button (<i>self</i>, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>&#160;<i>which</i>)</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>


<h3 class="fn"><a name="buttonRole" /><a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> QMessageBox.buttonRole (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a>&#160;<i>button</i>)</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>


<h3 class="fn"><a name="buttons" />list-of-QAbstractButton QMessageBox.buttons (<i>self</i>)</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>


<h3 class="fn"><a name="buttonText" />QString QMessageBox.buttonText (<i>self</i>, int&#160;<i>button</i>)</h3><h3 class="fn"><a name="changeEvent" />QMessageBox.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>


<h3 class="fn"><a name="clickedButton" /><a href="qabstractbutton.html">QAbstractButton</a> QMessageBox.clickedButton (<i>self</i>)</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 0.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qmessagebox.html">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><a href="qmessagebox.html#addButton">addButton</a>(tr(<span class="string">"Disconnect"</span>)<span class="operator">,</span> <span class="type"><a href="qmessagebox.html">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><a href="qmessagebox.html#exec">exec_</a>();
 <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>


<h3 class="fn"><a name="closeEvent" />QMessageBox.closeEvent (<i>self</i>, <a href="qcloseevent.html">QCloseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#closeEvent">QWidget.closeEvent</a>().</p>


<h3 class="fn"><a name="critical" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.critical (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a>&#160;<i>buttons</i>&#160;=&#160;QMessageBox.Ok, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>&#160;<i>defaultButton</i>&#160;=&#160;QMessageBox.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="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>


<h3 class="fn"><a name="critical-2" />int QMessageBox.critical (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>, int&#160;<i>button2</i>&#160;=&#160;0)</h3><h3 class="fn"><a name="critical-3" />int QMessageBox.critical (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, QString&#160;<i>button0Text</i>, QString&#160;<i>button1Text</i>&#160;=&#160;QString(), QString&#160;<i>button2Text</i>&#160;=&#160;QString(), int&#160;<i>defaultButtonNumber</i>&#160;=&#160;0, int&#160;<i>escapeButtonNumber</i>&#160;=&#160;-1)</h3><h3 class="fn"><a name="defaultButton" /><a href="qpushbutton.html">QPushButton</a> QMessageBox.defaultButton (<i>self</i>)</h3><p>Returns the button that should be the message box's <a href="qpushbutton.html#default-prop">default button</a>. Returns 0 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>


<h3 class="fn"><a name="detailedText" />QString QMessageBox.detailedText (<i>self</i>)</h3><h3 class="fn"><a name="escapeButton" /><a href="qabstractbutton.html">QAbstractButton</a> QMessageBox.escapeButton (<i>self</i>)</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">
<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 Mac OS X 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>


<h3 class="fn"><a name="event" />bool QMessageBox.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="icon" /><a href="qmessagebox.html#Icon-enum">Icon</a> QMessageBox.icon (<i>self</i>)</h3><h3 class="fn"><a name="iconPixmap" /><a href="qpixmap.html">QPixmap</a> QMessageBox.iconPixmap (<i>self</i>)</h3><h3 class="fn"><a name="information" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.information (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a>&#160;<i>buttons</i>&#160;=&#160;QMessageBox.Ok, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>&#160;<i>defaultButton</i>&#160;=&#160;QMessageBox.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="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>


<h3 class="fn"><a name="information-2" />int QMessageBox.information (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>&#160;=&#160;0, int&#160;<i>button2</i>&#160;=&#160;0)</h3><h3 class="fn"><a name="information-3" />int QMessageBox.information (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, QString&#160;<i>button0Text</i>, QString&#160;<i>button1Text</i>&#160;=&#160;QString(), QString&#160;<i>button2Text</i>&#160;=&#160;QString(), int&#160;<i>defaultButtonNumber</i>&#160;=&#160;0, int&#160;<i>escapeButtonNumber</i>&#160;=&#160;-1)</h3><h3 class="fn"><a name="informativeText" />QString QMessageBox.informativeText (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QMessageBox.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p>


<h3 class="fn"><a name="open" />QMessageBox.open (<i>self</i>)</h3><p>This is an overloaded function.</p>
<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>


<h3 class="fn"><a name="open-2" />QMessageBox.open (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()SLOT()&#160;<i>member</i>)</h3><h3 class="fn"><a name="open-3" />QMessageBox.open (<i>self</i>, callable&#160;<i>receiver</i>)</h3><h3 class="fn"><a name="question" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.question (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a>&#160;<i>buttons</i>&#160;=&#160;QMessageBox.Ok, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>&#160;<i>defaultButton</i>&#160;=&#160;QMessageBox.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="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>


<h3 class="fn"><a name="question-2" />int QMessageBox.question (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>&#160;=&#160;0, int&#160;<i>button2</i>&#160;=&#160;0)</h3><h3 class="fn"><a name="question-3" />int QMessageBox.question (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, QString&#160;<i>button0Text</i>, QString&#160;<i>button1Text</i>&#160;=&#160;QString(), QString&#160;<i>button2Text</i>&#160;=&#160;QString(), int&#160;<i>defaultButtonNumber</i>&#160;=&#160;0, int&#160;<i>escapeButtonNumber</i>&#160;=&#160;-1)</h3><h3 class="fn"><a name="removeButton" />QMessageBox.removeButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a>&#160;<i>button</i>)</h3><p>The <i>button</i> argument</p><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>


<h3 class="fn"><a name="resizeEvent" />QMessageBox.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>


<h3 class="fn"><a name="setButtonText" />QMessageBox.setButtonText (<i>self</i>, int&#160;<i>button</i>, QString)</h3><h3 class="fn"><a name="setDefaultButton" />QMessageBox.setDefaultButton (<i>self</i>, <a href="qpushbutton.html">QPushButton</a>&#160;<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>


<h3 class="fn"><a name="setDefaultButton-2" />QMessageBox.setDefaultButton (<i>self</i>, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>&#160;<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>


<h3 class="fn"><a name="setDetailedText" />QMessageBox.setDetailedText (<i>self</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="setEscapeButton" />QMessageBox.setEscapeButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a>&#160;<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>


<h3 class="fn"><a name="setEscapeButton-2" />QMessageBox.setEscapeButton (<i>self</i>, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>&#160;<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>


<h3 class="fn"><a name="setIcon" />QMessageBox.setIcon (<i>self</i>, <a href="qmessagebox.html#Icon-enum">Icon</a>)</h3><h3 class="fn"><a name="setIconPixmap" />QMessageBox.setIconPixmap (<i>self</i>, <a href="qpixmap.html">QPixmap</a>)</h3><h3 class="fn"><a name="setInformativeText" />QMessageBox.setInformativeText (<i>self</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="setStandardButtons" />QMessageBox.setStandardButtons (<i>self</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a>&#160;<i>buttons</i>)</h3><h3 class="fn"><a name="setText" />QMessageBox.setText (<i>self</i>, QString)</h3><h3 class="fn"><a name="setTextFormat" />QMessageBox.setTextFormat (<i>self</i>, <a href="qt.html#TextFormat-enum">Qt.TextFormat</a>)</h3><h3 class="fn"><a name="setWindowModality" />QMessageBox.setWindowModality (<i>self</i>, <a href="qt.html#WindowModality-enum">Qt.WindowModality</a>&#160;<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 Mac OS X, if the modality is set to <a href="qt.html#WindowModality-enum">Qt.WindowModal</a> and the message
box has a parent, then the message box will be a <a href="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>


<h3 class="fn"><a name="setWindowTitle" />QMessageBox.setWindowTitle (<i>self</i>, QString&#160;<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 Mac OS X,
the window title is ignored (as required by the Mac OS X
Guidelines).</p>
<p>This function was introduced in Qt 4.2.</p>


<h3 class="fn"><a name="showEvent" />QMessageBox.showEvent (<i>self</i>, <a href="qshowevent.html">QShowEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#showEvent">QWidget.showEvent</a>().</p>


<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QMessageBox.sizeHint (<i>self</i>)</h3><h3 class="fn"><a name="standardButton" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.standardButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a>&#160;<i>button</i>)</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>


<h3 class="fn"><a name="standardButtons" /><a href="qmessagebox-standardbuttons.html">StandardButtons</a> QMessageBox.standardButtons (<i>self</i>)</h3><h3 class="fn"><a name="standardIcon" /><a href="qpixmap.html">QPixmap</a> QMessageBox.standardIcon (<a href="qmessagebox.html#Icon-enum">Icon</a>&#160;<i>icon</i>)</h3><h3 class="fn"><a name="text" />QString QMessageBox.text (<i>self</i>)</h3><h3 class="fn"><a name="textFormat" /><a href="qt.html#TextFormat-enum">Qt.TextFormat</a> QMessageBox.textFormat (<i>self</i>)</h3><h3 class="fn"><a name="warning" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.warning (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a>&#160;<i>buttons</i>&#160;=&#160;QMessageBox.Ok, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>&#160;<i>defaultButton</i>&#160;=&#160;QMessageBox.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="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>
<h3 class="fn"><a name="warning-2" />int QMessageBox.warning (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, int&#160;<i>button0</i>, int&#160;<i>button1</i>, int&#160;<i>button2</i>&#160;=&#160;0)</h3><h3 class="fn"><a name="warning-3" />int QMessageBox.warning (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>text</i>, QString&#160;<i>button0Text</i>, QString&#160;<i>button1Text</i>&#160;=&#160;QString(), QString&#160;<i>button2Text</i>&#160;=&#160;QString(), int&#160;<i>defaultButtonNumber</i>&#160;=&#160;0, int&#160;<i>escapeButtonNumber</i>&#160;=&#160;-1)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="buttonClicked" />void buttonClicked (QAbstractButton *)</h3><p>This is the default overload of this signal.</p><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>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>