Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1539

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/dialogs/qmessagebox.cpp:138 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QMessageBox Class</title>
<style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QMessageBox Class Reference</h1>

<p>The QMessageBox class provides a modal dialog with a short message, an icon, and some buttons.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qmessagebox-h.html">qmessagebox.h</a>&gt;</tt>
<p>Inherits <a href="qdialog.html">QDialog</a>.
<p><a href="qmessagebox-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn>enum <a href="#Icon-enum"><b>Icon</b></a> { NoIcon = 0, Information = 1, Warning = 2, Critical = 3 }</div></li>
<li><div class=fn><a href="#QMessageBox"><b>QMessageBox</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li>
<li><div class=fn><a href="#QMessageBox-2"><b>QMessageBox</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text, Icon&nbsp;icon, int&nbsp;button0, int&nbsp;button1, int&nbsp;button2, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = TRUE, WFlags&nbsp;f = WStyle_DialogBorder )</div></li>
<li><div class=fn><a href="#~QMessageBox"><b>~QMessageBox</b></a> ()</div></li>
<li><div class=fn>QString <a href="#text"><b>text</b></a> () const</div></li>
<li><div class=fn>void <a href="#setText"><b>setText</b></a> ( const QString &amp; )</div></li>
<li><div class=fn>Icon <a href="#icon"><b>icon</b></a> () const</div></li>
<li><div class=fn>void <a href="#setIcon"><b>setIcon</b></a> ( Icon )</div></li>
<li><div class=fn>const QPixmap * <a href="#iconPixmap"><b>iconPixmap</b></a> () const</div></li>
<li><div class=fn>void <a href="#setIconPixmap"><b>setIconPixmap</b></a> ( const QPixmap &amp; )</div></li>
<li><div class=fn>QString <a href="#buttonText"><b>buttonText</b></a> ( int&nbsp;button ) const</div></li>
<li><div class=fn>void <a href="#setButtonText"><b>setButtonText</b></a> ( int&nbsp;button, const&nbsp;QString&nbsp;&amp;&nbsp;text )</div></li>
<li><div class=fn>virtual void <a href="#adjustSize"><b>adjustSize</b></a> ()</div></li>
<li><div class=fn>TextFormat <a href="#textFormat"><b>textFormat</b></a> () const</div></li>
<li><div class=fn>void <a href="#setTextFormat"><b>setTextFormat</b></a> ( TextFormat )</div></li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class=fn>int <a href="#information"><b>information</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;button0, int&nbsp;button1 = 0, int&nbsp;button2 = 0 )</div></li>
<li><div class=fn>int <a href="#information-2"><b>information</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QString&nbsp;&amp;&nbsp;button0Text = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;button1Text = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;button2Text = QString::null, int&nbsp;defaultButtonNumber = 0, int&nbsp;escapeButtonNumber = -1 )</div></li>
<li><div class=fn>int <a href="#warning"><b>warning</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;button0, int&nbsp;button1, int&nbsp;button2 = 0 )</div></li>
<li><div class=fn>int <a href="#warning-2"><b>warning</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QString&nbsp;&amp;&nbsp;button0Text = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;button1Text = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;button2Text = QString::null, int&nbsp;defaultButtonNumber = 0, int&nbsp;escapeButtonNumber = -1 )</div></li>
<li><div class=fn>int <a href="#critical"><b>critical</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;button0, int&nbsp;button1, int&nbsp;button2 = 0 )</div></li>
<li><div class=fn>int <a href="#critical-2"><b>critical</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QString&nbsp;&amp;&nbsp;button0Text = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;button1Text = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;button2Text = QString::null, int&nbsp;defaultButtonNumber = 0, int&nbsp;escapeButtonNumber = -1 )</div></li>
<li><div class=fn>void <a href="#about"><b>about</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text )</div></li>
<li><div class=fn>void <a href="#aboutQt"><b>aboutQt</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null )</div></li>
<li><div class=fn>int message ( const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QString&nbsp;&amp;&nbsp;buttonText = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const char * = 0 ) &nbsp;<em>(obsolete)</em></div></li>
<li><div class=fn>bool query ( const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QString&nbsp;&amp;&nbsp;yesButtonText = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;noButtonText = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const char * = 0 ) &nbsp;<em>(obsolete)</em></div></li>
<li><div class=fn>QPixmap standardIcon ( Icon&nbsp;icon, GUIStyle&nbsp;style ) &nbsp;<em>(obsolete)</em></div></li>
<li><div class=fn>QPixmap <a href="#standardIcon"><b>standardIcon</b></a> ( Icon&nbsp;icon )</div></li>
</ul>
<h2>Properties</h2>
<ul>
<li><div class=fn>Icon <a href="#icon-prop"><b>icon</b></a>&nbsp;- the messagebox icon</div></li>
<li><div class=fn>QPixmap <a href="#iconPixmap-prop"><b>iconPixmap</b></a>&nbsp;- the current icon</div></li>
<li><div class=fn>QString <a href="#text-prop"><b>text</b></a>&nbsp;- the message box text to be displayed</div></li>
<li><div class=fn>TextFormat <a href="#textFormat-prop"><b>textFormat</b></a>&nbsp;- the format of the text displayed by the message box</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QMessageBox class provides a modal dialog with a short message, an icon, and some buttons.


<p> A message box is a modal dialog that displays an icon, some text and up
to three push buttons.  It's used for simple messages and questions.
<p> QMessageBox provides a range of different messages, arranged roughly
along two axes: severity and complexity.
<p> Severity is
<ul>
<li> Information - for message boxes that are part of normal operation
<li> Warning - for message boxes that tell the user about unusual errors
<li> Critical - as Warning, but for critical errors
</ul>
<p> The message box has a different icon for each of the severity levels.
<p> Complexity is one button (OK) for a simple messages, or two or even
three buttons for questions.
<p> There are static functions for common cases.
For example:
<p> If a program is unable to find a supporting file, but can do perfectly
well without it:
<p> <pre>
QMessageBox::<a href="#information">information</a>( this, "Application name",
    "Unable to find the user preferences file.\n"
    "The factory default will be used instead." );
</pre>
 
<p> <a href="#warning">warning</a>() can be used to tell the user about unusual errors, or
errors which can't be easily fixed:
<p> <pre>
switch( QMessageBox::<a href="#warning">warning</a>( this, "Application name",
        "Could not connect to the &lt;mumble&gt; server.\n"
        "This program can't function correctly "
        "without the server.\n\n",
        "Retry",
        "Quit", 0, 0, 1 ) )
    case 0: // The user clicked the Retry again button or pressed Enter
        // try again
        break;
    case 1: // The user clicked the Quit or pressed Escape
        // exit
        break;
}
</pre>
 
<p> The text part of all message box messages can be either rich text or
plain text. If you specify a rich text formatted string, it will be
rendered using the default stylesheet. See
<a href="qstylesheet.html#defaultSheet">QStyleSheet::defaultSheet</a>() for details. With certain strings that
contain XML meta characters, the auto-rich text detection may fail,
interpreting plain text incorrectly as rich text. In these rare cases,
use <a href="qstylesheet.html#convertFromPlainText">QStyleSheet::convertFromPlainText</a>() to convert your plain text
string to a visually equivalent rich text string or set the text
format explicitly with <a href="#setTextFormat">setTextFormat</a>().
<p> Below are some examples of how to use the static member functions.
After these examples you will find an overview of the non-static
member functions.
<p> If a program is unable to find a supporting file, it may do the following:
<p> <pre>
QMessageBox::<a href="#information">information</a>( this, "Application name here",
    "Unable to find the file \"index.html\".\n"
    "The factory default will be used instead." );
</pre>
 
<p> The Microsoft Windows User Interface Guidelines strongly recommend
using the application name as the window's caption.  The message box
has just one button, OK, and its text tells the user both what
happened and what the program will do about it.  Because the
application is able to make do, the message box is just information,
not a warning or a critical error.
<p> Exiting a program is part of its normal operation. If there is
unsaved data the user probably should be asked if they want to save
the data. For example:
<p> <pre>
switch( QMessageBox::<a href="#information">information</a>( this, "Application name here",
        "The document contains unsaved changes\n"
        "Do you want to save the changes before exiting?",
        "&amp;Save", "&amp;Discard", "Cancel",
        0,      // Enter == button 0
        2 ) ) { // Escape == button 2
    case 0: // Save clicked or Alt+S pressed or Enter pressed.
        // save
        break;
    case 1: // Discard clicked or Alt+D pressed
        // don't save but exit
        break;
    case 2: // Cancel clicked or Alt+C pressed or Escape pressed
        // don't exit
        break;
}
</pre>
 
<p> The application name is used as the window caption in accordance with
the Microsoft recommendation.  The Escape button cancels the entire
exit operation, and pressing Enter causes the changes to be saved
before the exit occurs.
<p> Disk full errors are unusual (in a perfect world, they are) and they
certainly can be hard to correct.  This example uses predefined buttons
instead of hard-coded button texts:
<p> <pre>
switch( QMessageBox::<a href="#warning">warning</a>( this, "Application name here",
        "Could not save the user preferences,\n"
        "because the disk is full.  You can delete\n"
        "some files and press Retry, or you can\n"
        "abort the Save Preferences operation.",
        QMessageBox::Retry | QMessageBox::Default,
        QMessageBox::Abort | QMessageBox::Escape )) {
    case QMessageBox::Retry: // Retry clicked or Enter pressed
        // try again
        break;
    case QMessageBox::Abort: // Abort clicked or Escape pressed
        // abort
        break;
}
</pre>
 
<p> The <a href="#critical">critical</a>() function should be reserved for critical errors.  In
this example errorDetails is a <a href="qstring.html">QString</a> or const char*, and QString
is used to concatenate several strings:
<p> <pre>
QMessageBox::<a href="#critical">critical</a>( 0, "Application name here",
        QString("An internal error occurred. Please ") +
        "call technical support at 123456789 and report\n"+
        "these numbers:\n\n" + errorDetails +
        "\n\n&lt;Application&gt; will now exit." );
</pre>
 
<p> In this example an OK button is displayed.
<p> QMessageBox provides a very simple About box, which displays an
appropriate icon and the string you provide:
<p> <pre>
QMessageBox::<a href="#about">about</a>( this, "About &lt;Application&gt;",
        "&lt;Application&gt; is a &lt;one-paragraph blurb&gt;\n\n"
        "Copyright 1951-2002 Such-and-such.  "
        "&lt;License words here.&gt;\n\n"
        "For technical support, call 123456789 or see\n"
        "http://www.such-and-such.com/Application/\n" );
</pre>
 
<p> See <a href="#about">about</a>() for more information.
<p> Finally, you can create a QMessageBox from scratch and with custom
button texts:
<p> <pre>
QMessageBox mb( "Application name here",
        "Saving the file will overwrite the original file on the disk.\n"
        "Do you really want to save?",
        QMessageBox::<a href="#Icon-enum">Information</a>,
        QMessageBox::Yes | QMessageBox::Default,
        QMessageBox::No,
        QMessageBox::Cancel | QMessageBox::Escape );
mb.setButtonText( QMessageBox::Yes, "Save" );
mb.setButtonText( QMessageBox::No, "Discard" );
switch( mb.exec() ) {
    case QMessageBox::Yes:
        // save and exit
        break;
    case QMessageBox::No:
        // exit without saving
        break;
    case QMessageBox::Cancel:
        // don't save and don't exit
        break;
}
</pre>
 
<p> QMessageBox defines two enum types: Icon and an unnamed button type.
Icon defines the <a href="#Icon-enum">Information</a>, <a href="#Icon-enum">Warning</a>, and <a href="#Icon-enum">Critical</a> icons for
each GUI style.  It is used by the constructor and by the static
member functions <a href="#information">information</a>(), <a href="#warning">warning</a>() and <a href="#critical">critical</a>(). A function
called <a href="#standardIcon">standardIcon</a>() gives you access to the various icons.
<p> The button types are:
<ul>
<li> Ok - the default for single-button message boxes
<li> Cancel - note that this is <em>not</em> automatically Escape
<li> Yes
<li> No
<li> Abort
<li> Retry
<li> Ignore
</ul>
<p> Button types can be combined with two modifiers by using OR, '|':
<ul>
<li> Default - makes pressing Enter equivalent to
clicking this button.  Normally used with Ok, Yes or similar.
<li> Escape - makes pressing Escape equivalent to clicking this button.
Normally used with Abort, Cancel or similar.
</ul>
<p> The <a href="#text">text</a>(), <a href="#icon">icon</a>() and <a href="#iconPixmap">iconPixmap</a>() functions provide access to the
current text and pixmap of the message box. The <a href="#setText">setText</a>(), <a href="#setIcon">setIcon</a>()
and <a href="#setIconPixmap">setIconPixmap</a>() let you change it.  The difference between
setIcon() and setIconPixmap() is that the former accepts a
QMessageBox::Icon and can be used to set standard icons, whereas the
latter accepts a <a href="qpixmap.html">QPixmap</a> and can be used to set custom icons.
<p> <a href="#setButtonText">setButtonText</a>() and <a href="#buttonText">buttonText</a>() provide access to the buttons.
<p> QMessageBox has no signals or slots.
<p> <img src=qmsgbox-m.png> <img src=qmsgbox-w.png>
<p> <p>See also <a href="qdialog.html">QDialog</a>, <a href="http://www.iarchitect.com/errormsg.htm
	">Isys on error messages</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Message Box</a> and <a href="dialogs.html">Dialog Classes</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Icon-enum"></a>QMessageBox::Icon</h3>

<p> This enum includes provides the following values:
<ul>
<li><tt>QMessageBox::NoIcon</tt> - the message box does not have any icon.
<li><tt>QMessageBox::Information</tt> - an icon indicating that the message is nothing
out of the ordinary.
<li><tt>QMessageBox::Warning</tt> - an icon indicating that the message is a warning, but
can be dealt with.
<li><tt>QMessageBox::Critical</tt> - an icon indicating that the message represents a
critical problem.
</ul><p> 
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QMessageBox"></a>QMessageBox::QMessageBox ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a message box with no text and a button with the label "OK".
<p> If <em>parent</em> is 0, the message box becomes an application-global
modal dialog box.  If <em>parent</em> is a widget, the message box becomes
modal relative to <em>parent</em>.
<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qdialog.html">QDialog</a> constructor.

<h3 class=fn><a name="QMessageBox-2"></a>QMessageBox::QMessageBox ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qmessagebox.html#Icon-enum">Icon</a>&nbsp;icon, int&nbsp;button0, int&nbsp;button1, int&nbsp;button2, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = TRUE, WFlags&nbsp;f = WStyle_DialogBorder )
</h3>
Constructs a message box with a <em>caption</em>, a <em>text</em>, an <em>icon</em>, and up
to three buttons.
<p> The <em>icon</em> must be one of the following:
<ul>
<li> QMessageBox::NoIcon
<li> QMessageBox::Information
<li> QMessageBox::Warning
<li> QMessageBox::Critical
</ul>
<p> Each button, <em>button0</em>, <em>button1</em> and <em>button2</em>, can have one of
the following values:
<ul>
<li> QMessageBox::NoButton
<li> QMessageBox::Ok
<li> QMessageBox::Cancel
<li> QMessageBox::Yes
<li> QMessageBox::No
<li> QMessageBox::Abort
<li> QMessageBox::Retry
<li> QMessageBox::Ignore
</ul>
<p> Use QMessageBox::NoButton for the later parameters to have fewer than
three buttons in your message box.
<p> One of the buttons can be OR-ed with the <tt>QMessageBox::Default</tt> flag
to make it the default button (clicked when Enter is pressed).
<p> One of the buttons can be OR-ed with the <tt>QMessageBox::Escape</tt> flag
to make it the cancel or close button (clicked when Escape is pressed).
<p> Example:
<pre>
QMessageBox mb( "Application Name",
        "Hardware failure.\n\nDisk error detected\nDo you want to stop?",
        QMessageBox::<a href="#Icon-enum">NoIcon</a>,
        QMessageBox::Yes | QMessageBox::Default,
        QMessageBox::No  | QMessageBox::Escape
        QMessageBox::<a href="qt.html#ButtonState-enum">NoButton</a> );
if ( mb.exec() == QMessageBox::No )
    // try again
</pre>
 
<p> If <em>parent</em> is 0, the message box becomes an application-global
modal dialog box.  If <em>parent</em> is a widget, the message box becomes
modal relative to <em>parent</em>.
<p> If <em>modal</em> is TRUE the message becomes modal; otherwise it becomes
modeless.
<p> The <em>parent</em>, <em>name</em>, <em>modal</em>, and <em>f</em> arguments are passed to the
<a href="qdialog.html">QDialog</a> constructor.
<p> <p>See also <a href="qwidget.html#caption-prop">caption</a>, <a href="#text-prop">text</a> and <a href="#icon-prop">icon</a>.

<h3 class=fn><a name="~QMessageBox"></a>QMessageBox::~QMessageBox ()
</h3>
Destroys the message box.

<h3 class=fn>void <a name="about"></a>QMessageBox::about ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text )<tt> [static]</tt>
</h3>
Displays a simple about box with caption <em>caption</em> and
text <em>text</em>. The about box's parent is <em>parent</em>.
<p> <a href="#about">about</a>() looks for a suitable icon in four locations:
<ol type=1>
<li> It prefers <a href="qwidget.html#icon">parent->icon()</a>
if that exists.
<li> If not, it tries the top-level widget
containing <em>parent</em>.
<li> If that fails, it tries the <a href="qapplication.html#mainWidget">main widget.</a>
<li> As a last resort it uses the Information icon.
</ol>
<p> The about box has a single button labelled OK.
<p> <p>See also <a href="qwidget.html#icon-prop">QWidget::icon</a> and <a href="qapplication.html#mainWidget">QApplication::mainWidget</a>().

<p>Examples: <a href="qaction-application-example.html#x2025">action/application.cpp</a>, <a href="simple-application-example.html#x1923">application/application.cpp</a>, <a href="helpviewer-example.html#x1400">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x1154">mdi/application.cpp</a>, <a href="menu-example.html#x1128">menu/menu.cpp</a> and <a href="themes-example.html#x347">themes/themes.cpp</a>.
<h3 class=fn>void <a name="aboutQt"></a>QMessageBox::aboutQt ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption = QString::null )<tt> [static]</tt>
</h3>
Displays a simple message box about Qt, with caption <em>caption</em> and optionally centered over <em>parent</em>.  The message includes
the version number of Qt being used by the application.
<p> This is useful for inclusion in the Help menu.  See the
examples/menu/menu.cpp example.

<p>Examples: <a href="qaction-application-example.html#x2026">action/application.cpp</a>, <a href="simple-application-example.html#x1924">application/application.cpp</a>, <a href="helpviewer-example.html#x1401">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x1155">mdi/application.cpp</a>, <a href="menu-example.html#x1129">menu/menu.cpp</a>, <a href="themes-example.html#x348">themes/themes.cpp</a> and <a href="trivial-nsplugin-example.html#x2588">trivial/trivial.cpp</a>.
<h3 class=fn>void <a name="adjustSize"></a>QMessageBox::adjustSize ()<tt> [virtual]</tt>
</h3>
Adjusts the size of the message box to fit the contents just before
<a href="qdialog.html#exec">QDialog::exec</a>() or <a href="qdialog.html#show">QDialog::show</a>() is called.
<p> This function will not be called if the message box has been explicitly
resized before showing it.

<p>Reimplemented from <a href="qwidget.html#adjustSize">QWidget</a>.
<h3 class=fn><a href="qstring.html">QString</a> <a name="buttonText"></a>QMessageBox::buttonText ( int&nbsp;button ) const
</h3>
Returns the text of the messagebox button <em>button</em>, or null if the
message box does not contain the button.
<p> <p>See also <a href="#setButtonText">setButtonText</a>().

<h3 class=fn>int <a name="critical"></a>QMessageBox::critical ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;button0, int&nbsp;button1, int&nbsp;button2 = 0 )<tt> [static]</tt>
</h3>
Opens a critical message box with the caption <em>caption</em> and the
text <em>text</em>. The dialog may have up to three buttons. Each of the
button parameters, <em>button0</em>, <em>button1</em> and <em>button2</em> may be set to
one of the following values:
<p> <ul>
<li> QMessageBox::NoButton
<li> QMessageBox::Ok
<li> QMessageBox::Cancel
<li> QMessageBox::Yes
<li> QMessageBox::No
<li> QMessageBox::Abort
<li> QMessageBox::Retry
<li> QMessageBox::Ignore
</ul>
<p> If you don't want all three buttons, set the last button, or last two
buttons to QMessageBox::NoButton.
<p> Returns the index of the button that was clicked.
<p> If <em>parent</em> is 0, the message box becomes an application-global
modal dialog box.  If <em>parent</em> is a widget, the message box becomes
modal relative to <em>parent</em>.
<p> <p>See also <a href="#information">information</a>() and <a href="#warning">warning</a>().

<p>Examples: <a href="ftpclient-example.html#x1016">network/ftpclient/ftpmainwindow.cpp</a>, <a href="process-example.html#x866">process/process.cpp</a> and <a href="outliner-example.html#x66">xml/outliner/outlinetree.cpp</a>.
<h3 class=fn>int <a name="critical-2"></a>QMessageBox::critical ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;button0Text = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;button1Text = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;button2Text = QString::null, int&nbsp;defaultButtonNumber = 0, int&nbsp;escapeButtonNumber = -1 )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Displays a critical error message box with a caption, a text, and
1..3 buttons.  Returns the number of the button that was clicked
(0, 1 or 2).
<p> <em>button0Text</em> is the text of the first button and is optional.  If
<em>button0Text</em> is not supplied, "OK" (translated) will be used.
<em>button1Text</em> is the text of the second button and is optional, and
<em>button2Text</em> is the text of the third button and is optional.  <em>defaultButtonNumber</em> (0..2) is the index of the default button;
pressing Return or Enter is the same as clicking the default button.
It defaults to 0 (the first button).  <em>escapeButtonNumber</em> is the
index of the Escape button; pressing Escape is the same as clicking
this button.  It defaults to -1 (pressing Escape does nothing);
supply 0, 1, or 2 to make pressing Escape equivalent to clicking
the relevant button.
<p> If <em>parent</em> is 0, the message box becomes an application-global
modal dialog box.  If <em>parent</em> is a widget, the message box becomes
modal relative to <em>parent</em>.
<p> <p>See also <a href="#information">information</a>() and <a href="#warning">warning</a>().

<h3 class=fn><a href="qmessagebox.html#Icon-enum">Icon</a> <a name="icon"></a>QMessageBox::icon () const
</h3><p>Returns the messagebox icon.
See the <a href="qmessagebox.html#icon-prop">"icon"</a> property for details.
<h3 class=fn>const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;* <a name="iconPixmap"></a>QMessageBox::iconPixmap () const
</h3><p>Returns the current icon.
See the <a href="qmessagebox.html#iconPixmap-prop">"iconPixmap"</a> property for details.
<h3 class=fn>int <a name="information"></a>QMessageBox::information ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;button0, int&nbsp;button1 = 0, int&nbsp;button2 = 0 )<tt> [static]</tt>
</h3>
Opens an information message box with the caption <em>caption</em> and the
text <em>text</em>. The dialog may have up to three buttons. Each of the
buttons, <em>button0</em>, <em>button1</em> and <em>button2</em> may be set to
one of the following values:
<p> <ul>
<li> QMessageBox::NoButton
<li> QMessageBox::Ok
<li> QMessageBox::Cancel
<li> QMessageBox::Yes
<li> QMessageBox::No
<li> QMessageBox::Abort
<li> QMessageBox::Retry
<li> QMessageBox::Ignore
</ul>
<p> If you don't want all three buttons, set the last button, or last two
buttons to QMessageBox::NoButton.
<p> Returns the index of the button that was clicked.
<p> If <em>parent</em> is 0, the message box becomes an application-global
modal dialog box.  If <em>parent</em> is a widget, the message box becomes
modal relative to <em>parent</em>.
<p> <p>See also <a href="#warning">warning</a>() and <a href="#critical">critical</a>().

<p>Examples: <a href="qaction-application-example.html#x2027">action/application.cpp</a>, <a href="simple-application-example.html#x1925">application/application.cpp</a>, <a href="dirview-example.html#x1688">dirview/dirview.cpp</a>, <a href="fileiconview-example.html#x1570">fileiconview/qfileiconview.cpp</a>, <a href="picture-example.html#x907">picture/picture.cpp</a>, <a href="qwerty-example.html#x635">qwerty/qwerty.cpp</a> and <a href="sqltable-example.html#x2635">sql/sqltable/main.cpp</a>.
<h3 class=fn>int <a name="information-2"></a>QMessageBox::information ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;button0Text = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;button1Text = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;button2Text = QString::null, int&nbsp;defaultButtonNumber = 0, int&nbsp;escapeButtonNumber = -1 )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Displays an information message box with caption <em>caption</em>, text <em>text</em> and one, two or three buttons. Returns the index of the button
that was clicked (0, 1 or 2).
<p> <em>button0Text</em> is the text of the first button and is optional.  If
<em>button0Text</em> is not supplied, "OK" (translated) will be used.
<em>button1Text</em> is the text of the second button and is optional.
<em>button2Text</em> is the text of the third button and is optional.  <em>defaultButtonNumber</em> (0..2) is the index of the default button;
pressing Return or Enter is the same as clicking the default button.
It defaults to 0 (the first button).  <em>escapeButtonNumber</em> is the
index of the Escape button; pressing Escape is the same as clicking
this button.  It defaults to -1 (pressing Escape does nothing);
supply 0, 1 or 2 to make pressing Escape equivalent to clicking
the relevant button.
<p> If <em>parent</em> is 0, the message box becomes an application-global
modal dialog box.  If <em>parent</em> is a widget, the message box becomes
modal relative to <em>parent</em>.
<p> <p>See also <a href="#warning">warning</a>() and <a href="#critical">critical</a>().

<h3 class=fn>int <a name="message"></a>QMessageBox::message ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;buttonText = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const char * = 0 )<tt> [static]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Opens a modal message box directly using the specified parameters.
<p> Please use <a href="#information">information</a>(), <a href="#warning">warning</a>() or <a href="#critical">critical</a>() instead.

<p>Example: <a href="grapher-nsplugin-example.html#x2602">grapher/grapher.cpp</a>.
<h3 class=fn>bool <a name="query"></a>QMessageBox::query ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;yesButtonText = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;noButtonText = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const char * = 0 )<tt> [static]</tt>
</h3> 
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Queries the user using a modal message box with two buttons.
Note that <em>caption</em> is not always shown, it depends on the window manager.
<p> Please use <a href="#information">information</a>(), <a href="#warning">warning</a>() or <a href="#critical">critical</a>() instead.

<h3 class=fn>void <a name="setButtonText"></a>QMessageBox::setButtonText ( int&nbsp;button, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text )
</h3>
Sets the text of the message box button <em>button</em> to <em>text</em>.
Setting the text of a button that is not in the message box is
silently ignored.
<p> <p>See also <a href="#buttonText">buttonText</a>().

<h3 class=fn>void <a name="setIcon"></a>QMessageBox::setIcon ( <a href="qmessagebox.html#Icon-enum">Icon</a> )
</h3><p>Sets the messagebox icon.
See the <a href="qmessagebox.html#icon-prop">"icon"</a> property for details.
<h3 class=fn>void <a name="setIconPixmap"></a>QMessageBox::setIconPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp; )
</h3><p>Sets the current icon.
See the <a href="qmessagebox.html#iconPixmap-prop">"iconPixmap"</a> property for details.
<h3 class=fn>void <a name="setText"></a>QMessageBox::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )
</h3><p>Sets the message box text to be displayed.
See the <a href="qmessagebox.html#text-prop">"text"</a> property for details.
<h3 class=fn>void <a name="setTextFormat"></a>QMessageBox::setTextFormat ( <a href="qt.html#TextFormat-enum">TextFormat</a> )
</h3><p>Sets the format of the text displayed by the message box.
See the <a href="qmessagebox.html#textFormat-prop">"textFormat"</a> property for details.
<h3 class=fn><a href="qpixmap.html">QPixmap</a> <a name="standardIcon"></a>QMessageBox::standardIcon ( <a href="qmessagebox.html#Icon-enum">Icon</a>&nbsp;icon )<tt> [static]</tt>
</h3>
Returns the pixmap used for a standard icon.  This
allows the pixmaps to be used in more complex message boxes.
<em>icon</em> specifies the required icon, e.g. QMessageBox::Information,
QMessageBox::Warning or QMessageBox::Critical.

<h3 class=fn><a href="qpixmap.html">QPixmap</a> <a name="standardIcon-2"></a>QMessageBox::standardIcon ( <a href="qmessagebox.html#Icon-enum">Icon</a>&nbsp;icon, <a href="qt.html#GUIStyle-enum">GUIStyle</a>&nbsp;style )<tt> [static]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns the pixmap used for a standard icon.  This
allows the pixmaps to be used in more complex message boxes.
<em>icon</em> specifies the required icon, e.g. QMessageBox::Information,
QMessageBox::Warning or QMessageBox::Critical.
<p> <em>style</em> is unused.

<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QMessageBox::text () const
</h3><p>Returns the message box text to be displayed.
See the <a href="qmessagebox.html#text-prop">"text"</a> property for details.
<h3 class=fn><a href="qt.html#TextFormat-enum">TextFormat</a> <a name="textFormat"></a>QMessageBox::textFormat () const
</h3><p>Returns the format of the text displayed by the message box.
See the <a href="qmessagebox.html#textFormat-prop">"textFormat"</a> property for details.
<h3 class=fn>int <a name="warning"></a>QMessageBox::warning ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;button0, int&nbsp;button1, int&nbsp;button2 = 0 )<tt> [static]</tt>
</h3>
Opens a warning message box with the caption <em>caption</em> and the
text <em>text</em>. The dialog may have up to three buttons. Each of the
button parameters, <em>button0</em>, <em>button1</em> and <em>button2</em> may be set to
one of the following values:
<p> <ul>
<li> QMessageBox::NoButton
<li> QMessageBox::Ok
<li> QMessageBox::Cancel
<li> QMessageBox::Yes
<li> QMessageBox::No
<li> QMessageBox::Abort
<li> QMessageBox::Retry
<li> QMessageBox::Ignore
</ul>
<p> If you don't want all three buttons, set the last button, or last two
buttons to QMessageBox::NoButton.
<p> Returns the index of the button that was clicked.
<p> If <em>parent</em> is 0, the message box becomes an application-global
modal dialog box.  If <em>parent</em> is a widget, the message box becomes
modal relative to <em>parent</em>.
<p> <p>See also <a href="#information">information</a>() and <a href="#critical">critical</a>().

<p>Examples: <a href="i18n-example.html#x1374">i18n/main.cpp</a>, <a href="movies-example.html#x1084">movies/main.cpp</a>, <a href="mail-example.html#x974">network/mail/smtp.cpp</a>, <a href="qwerty-example.html#x636">qwerty/qwerty.cpp</a>, <a href="showimg-example.html#x433">showimg/showimg.cpp</a> and <a href="sound-example.html#x2483">sound/sound.cpp</a>.
<h3 class=fn>int <a name="warning-2"></a>QMessageBox::warning ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;button0Text = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;button1Text = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;button2Text = QString::null, int&nbsp;defaultButtonNumber = 0, int&nbsp;escapeButtonNumber = -1 )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Displays a warning message box with a caption, a text, and
1..3 buttons.  Returns the number of the button that was clicked
(0, 1, or 2).
<p> <em>button0Text</em> is the text of the first button and is optional.  If
<em>button0Text</em> is not supplied, "OK" (translated) will be used.
<em>button1Text</em> is the text of the second button and is optional, and
<em>button2Text</em> is the text of the third button and is optional.  <em>defaultButtonNumber</em> (0..2) is the index of the default button;
pressing Return or Enter is the same as clicking the default button.
It defaults to 0 (the first button).  <em>escapeButtonNumber</em> is the
index of the Escape button; pressing Escape is the same as clicking
this button.  It defaults to -1 (pressing Escape does nothing);
supply 0, 1, or 2 to make pressing Escape equivalent to clicking
the relevant button.
<p> If <em>parent</em> is 0, the message box becomes an application-global
modal dialog box.  If <em>parent</em> is a widget, the message box becomes
modal relative to <em>parent</em>.
<p> <p>See also <a href="#information">information</a>() and <a href="#critical">critical</a>().

<hr><h2>Property Documentation</h2>
<h3 class=fn><a href="qmessagebox.html#Icon-enum">Icon</a> <a name="icon-prop"></a>icon</h3>
<p>This property holds the messagebox icon.
<p>The icon of the message box can be one of the following predefined icons:
<ul>
<li> QMessageBox::NoIcon
<li> QMessageBox::Information
<li> QMessageBox::Warning
<li> QMessageBox::Critical
</ul>
<p> The actual pixmap used for displaying the icon depends on the current
<a href="qwidget.html#style">GUI style</a>.  You can also set a custom
pixmap icon using the <a href="#iconPixmap-prop">QMessageBox::iconPixmap</a> property. The
default icon is QMessageBox::NoIcon.
<p> <p>See also <a href="#iconPixmap-prop">iconPixmap</a>.

<p>Set this property's value with <a href="#setIcon">setIcon</a>() and get this property's value with <a href="#icon">icon</a>().
<h3 class=fn><a href="qpixmap.html">QPixmap</a> <a name="iconPixmap-prop"></a>iconPixmap</h3>
<p>This property holds the current icon.
<p>The icon currently used by the message box. Note that
it's often hard to draw one pixmap that looks appropriate in both
Motif and Windows GUI styles; you may want to draw two pixmaps.
<p> <p>See also <a href="#icon-prop">icon</a>.

<p>Set this property's value with <a href="#setIconPixmap">setIconPixmap</a>() and get this property's value with <a href="#iconPixmap">iconPixmap</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="text-prop"></a>text</h3>
<p>This property holds the message box text to be displayed.
<p>The text will be interpreted either as a plain text or as a rich
text, depending on the text format setting (<a href="#textFormat-prop">QMessageBox::textFormat</a>). The
default setting is <a href="qt.html#TextFormat-enum">AutoText</a>, i.e. the message box will try to
auto-detect the format of the text.
<p> The default value of the property is QString::null.
<p> <p>See also <a href="#textFormat-prop">textFormat</a>.

<p>Set this property's value with <a href="#setText">setText</a>() and get this property's value with <a href="#text">text</a>().
<h3 class=fn><a href="qt.html#TextFormat-enum">TextFormat</a> <a name="textFormat-prop"></a>textFormat</h3>
<p>This property holds the format of the text displayed by the message box.
<p>The current text format used by the message box.
See the <a href="qt.html#TextFormat-enum">Qt::TextFormat</a> enum for an explanation of the possible options.
<p> The default format is <a href="qt.html#TextFormat-enum">AutoText</a>.
<p> <p>See also <a href="#text-prop">text</a>.

<p>Set this property's value with <a href="#setTextFormat">setTextFormat</a>() and get this property's value with <a href="#textFormat">textFormat</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>