diff options
Diffstat (limited to 'doc/html/qmessagebox.html')
-rw-r--r-- | doc/html/qmessagebox.html | 751 |
1 files changed, 751 insertions, 0 deletions
diff --git a/doc/html/qmessagebox.html b/doc/html/qmessagebox.html new file mode 100644 index 000000000..3223b16ea --- /dev/null +++ b/doc/html/qmessagebox.html @@ -0,0 +1,751 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/dialogs/qmessagebox.cpp:149 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>TQMessageBox Class</title> +<style type="text/css"><!-- +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 Classes</font></a> + | <a href="mainclasses.html"> +<font color="#004faf">Main Classes</font></a> + | <a href="annotated.html"> +<font color="#004faf">Annotated</font></a> + | <a href="groups.html"> +<font color="#004faf">Grouped 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>TQMessageBox Class Reference</h1> + +<p>The TQMessageBox class provides a modal dialog with a short message, an icon, and some buttons. +<a href="#details">More...</a> +<p><tt>#include <<a href="qmessagebox-h.html">qmessagebox.h</a>></tt> +<p>Inherits <a href="qdialog.html">TQDialog</a>. +<p><a href="qmessagebox-members.html">List of all member functions.</a> +<h2>Public Members</h2> +<ul> +<li class=fn>enum <a href="#Icon-enum"><b>Icon</b></a> { NoIcon = 0, Information = 1, Warning = 2, Critical = 3, Question = 4 }</li> +<li class=fn><a href="#TQMessageBox"><b>TQMessageBox</b></a> ( TQWidget * parent = 0, const char * name = 0 )</li> +<li class=fn><a href="#TQMessageBox-2"><b>TQMessageBox</b></a> ( const TQString & caption, const TQString & text, Icon icon, int button0, int button1, int button2, TQWidget * parent = 0, const char * name = 0, bool modal = TRUE, WFlags f = WStyle_DialogBorder )</li> +<li class=fn><a href="#~TQMessageBox"><b>~TQMessageBox</b></a> ()</li> +<li class=fn>TQString <a href="#text"><b>text</b></a> () const</li> +<li class=fn>void <a href="#setText"><b>setText</b></a> ( const TQString & )</li> +<li class=fn>Icon <a href="#icon"><b>icon</b></a> () const</li> +<li class=fn>void <a href="#setIcon"><b>setIcon</b></a> ( Icon )</li> +<li class=fn>const TQPixmap * <a href="#iconPixmap"><b>iconPixmap</b></a> () const</li> +<li class=fn>void <a href="#setIconPixmap"><b>setIconPixmap</b></a> ( const TQPixmap & )</li> +<li class=fn>TQString <a href="#buttonText"><b>buttonText</b></a> ( int button ) const</li> +<li class=fn>void <a href="#setButtonText"><b>setButtonText</b></a> ( int button, const TQString & text )</li> +<li class=fn>virtual void <a href="#adjustSize"><b>adjustSize</b></a> ()</li> +<li class=fn>TextFormat <a href="#textFormat"><b>textFormat</b></a> () const</li> +<li class=fn>void <a href="#setTextFormat"><b>setTextFormat</b></a> ( TextFormat )</li> +</ul> +<h2>Static Public Members</h2> +<ul> +<li class=fn>int <a href="#information"><b>information</b></a> ( TQWidget * parent, const TQString & caption, const TQString & text, int button0, int button1 = 0, int button2 = 0 )</li> +<li class=fn>int <a href="#information-2"><b>information</b></a> ( TQWidget * parent, const TQString & caption, const TQString & text, const TQString & button0Text = TQString::null, const TQString & button1Text = TQString::null, const TQString & button2Text = TQString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1 )</li> +<li class=fn>int <a href="#question"><b>question</b></a> ( TQWidget * parent, const TQString & caption, const TQString & text, int button0, int button1 = 0, int button2 = 0 )</li> +<li class=fn>int <a href="#question-2"><b>question</b></a> ( TQWidget * parent, const TQString & caption, const TQString & text, const TQString & button0Text = TQString::null, const TQString & button1Text = TQString::null, const TQString & button2Text = TQString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1 )</li> +<li class=fn>int <a href="#warning"><b>warning</b></a> ( TQWidget * parent, const TQString & caption, const TQString & text, int button0, int button1, int button2 = 0 )</li> +<li class=fn>int <a href="#warning-2"><b>warning</b></a> ( TQWidget * parent, const TQString & caption, const TQString & text, const TQString & button0Text = TQString::null, const TQString & button1Text = TQString::null, const TQString & button2Text = TQString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1 )</li> +<li class=fn>int <a href="#critical"><b>critical</b></a> ( TQWidget * parent, const TQString & caption, const TQString & text, int button0, int button1, int button2 = 0 )</li> +<li class=fn>int <a href="#critical-2"><b>critical</b></a> ( TQWidget * parent, const TQString & caption, const TQString & text, const TQString & button0Text = TQString::null, const TQString & button1Text = TQString::null, const TQString & button2Text = TQString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1 )</li> +<li class=fn>void <a href="#about"><b>about</b></a> ( TQWidget * parent, const TQString & caption, const TQString & text )</li> +<li class=fn>void <a href="#aboutTQt"><b>aboutTQt</b></a> ( TQWidget * parent, const TQString & caption = TQString::null )</li> +<li class=fn>int message ( const TQString & caption, const TQString & text, const TQString & buttonText = TQString::null, TQWidget * parent = 0, const char * = 0 ) <em>(obsolete)</em></li> +<li class=fn>bool query ( const TQString & caption, const TQString & text, const TQString & yesButtonText = TQString::null, const TQString & noButtonText = TQString::null, TQWidget * parent = 0, const char * = 0 ) <em>(obsolete)</em></li> +<li class=fn>TQPixmap standardIcon ( Icon icon, GUIStyle style ) <em>(obsolete)</em></li> +<li class=fn>TQPixmap <a href="#standardIcon"><b>standardIcon</b></a> ( Icon icon )</li> +</ul> +<h2>Properties</h2> +<ul> +<li class=fn>Icon <a href="#icon-prop"><b>icon</b></a> - the message box's icon</li> +<li class=fn>TQPixmap <a href="#iconPixmap-prop"><b>iconPixmap</b></a> - the current icon</li> +<li class=fn>TQString <a href="#text-prop"><b>text</b></a> - the message box text to be displayed</li> +<li class=fn>TextFormat <a href="#textFormat-prop"><b>textFormat</b></a> - the format of the text displayed by the message box</li> +</ul> +<hr><a name="details"></a><h2>Detailed Description</h2> + + +The TQMessageBox class provides a modal dialog with a short message, an icon, and some buttons. + + +<p> Message boxes are used to provide informative messages and to ask +simple questions. +<p> TQMessageBox provides a range of different messages, arranged +roughly along two axes: severity and complexity. +<p> Severity is +<center><table cellpadding="4" cellspacing="2" border="0"> +<tr bgcolor="#f0f0f0"> +<td valign="top"><center><img src="qmessagebox-quest.png"></center> <td valign="top">Question +<td valign="top">For message boxes that ask a question as part of normal +operation. Some style guides recommend using Information for this +purpose. +<tr bgcolor="#d0d0d0"> +<td valign="top"><center><img src="qmessagebox-info.png"></center> <td valign="top">Information +<td valign="top">For message boxes that are part of normal operation. +<tr bgcolor="#f0f0f0"> +<td valign="top"><center><img src="qmessagebox-warn.png"></center> <td valign="top">Warning +<td valign="top">For message boxes that tell the user about unusual errors. +<tr bgcolor="#d0d0d0"> +<td valign="top"><center><img src="qmessagebox-crit.png"></center> <td valign="top">Critical +<td valign="top">For message boxes that tell the user about critical errors. +</table></center> +<p> The message box has a different icon for each of the severity levels. +<p> Complexity is one button (OK) for simple messages, or two or even +three buttons for questions. +<p> There are static functions for the most common cases. +<p> Examples: +<p> If a program is unable to find a supporting file, but can do perfectly +well without it: +<p> <pre> + TQMessageBox::<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="#question">question</a>() is useful for simple yes/no questions: +<p> <pre> + if ( TQFile::<a href="qfile.html#exists">exists</a>( filename ) && + TQMessageBox::<a href="#question">question</a>( + this, + <a href="qobject.html#tr">tr</a>("Overwrite File? -- Application Name"), + <a href="qobject.html#tr">tr</a>("A file called %1 already exists." + "Do you want to overwrite it?") + .arg( filename ), + <a href="qobject.html#tr">tr</a>("&Yes"), tr("&No"), + <a href="qstring.html#TQString-null">TQString::null</a>, 0, 1 ) ) + return false; + </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( TQMessageBox::<a href="#warning">warning</a>( this, "Application name", + "Could not connect to the <mumble> 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">TQStyleSheet::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">TQStyleSheet::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> Note that the Microsoft Windows User Interface Guidelines +recommend using the application name as the window's caption. +<p> Below are more examples of how to use the static member functions. +After these examples you will find an overview of the non-static +member functions. +<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( TQMessageBox::<a href="#information">information</a>( this, "Application name here", + "The document contains unsaved changes\n" + "Do you want to save the changes before exiting?", + "&Save", "&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 Escape pressed + // don't exit + break; + } + </pre> + +<p> 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 and they certainly can be hard to +correct. This example uses predefined buttons instead of +hard-coded button texts: +<p> <pre> + switch( TQMessageBox::<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.", + TQMessageBox::Retry | TQMessageBox::Default, + TQMessageBox::Abort | TQMessageBox::Escape )) { + case TQMessageBox::Retry: // Retry clicked or Enter pressed + // try again + break; + case TQMessageBox::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">TQString</a> or const char*, and TQString +is used to concatenate several strings: +<p> <pre> + TQMessageBox::<a href="#critical">critical</a>( 0, "Application name here", + TQString("An internal error occurred. Please ") + + "call technical support at 1234-56789 and report\n"+ + "these numbers:\n\n" + errorDetails + + "\n\nApplication will now exit." ); + </pre> + +<p> In this example an OK button is displayed. +<p> TQMessageBox provides a very simple About box which displays an +appropriate icon and the string you provide: +<p> <pre> + TQMessageBox::<a href="#about">about</a>( this, "About <Application>", + "<Application> is a <one-paragraph blurb>\n\n" + "Copyright 1991-2003 Such-and-such. " + "<License words here.>\n\n" + "For technical support, call 1234-56789 or see\n" + "http://www.such-and-such.com/Application/\n" ); + </pre> + +<p> See <a href="#about">about</a>() for more information. +<p> If you want your users to know that the application is built using +TQt (so they know that you use high quality tools) you might like +to add an "About TQt" menu option under the Help menu to invoke +<a href="#aboutTQt">aboutTQt</a>(). +<p> If none of the standard message boxes is suitable, you can create a +TQMessageBox from scratch and use custom button texts: +<p> <pre> + TQMessageBox mb( "Application name here", + "Saving the file will overwrite the original file on the disk.\n" + "Do you really want to save?", + TQMessageBox::<a href="#Icon-enum">Information</a>, + TQMessageBox::Yes | TQMessageBox::Default, + TQMessageBox::No, + TQMessageBox::Cancel | TQMessageBox::Escape ); + mb.<a href="#setButtonText">setButtonText</a>( TQMessageBox::Yes, "Save" ); + mb.<a href="#setButtonText">setButtonText</a>( TQMessageBox::No, "Discard" ); + switch( mb.<a href="qdialog.html#exec">exec</a>() ) { + case TQMessageBox::Yes: + // save and exit + break; + case TQMessageBox::No: + // exit without saving + break; + case TQMessageBox::Cancel: + // don't save and don't exit + break; + } + </pre> + +<p> TQMessageBox defines two enum types: Icon and an unnamed button type. +Icon defines the <a href="#Icon-enum">Question</a>, <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="#question">question</a>(), <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 +<li> YesAll +<li> NoAll +</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 +TQMessageBox::Icon and can be used to set standard icons, whereas the +latter accepts a <a href="qpixmap.html">TQPixmap</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> TQMessageBox has no signals or slots. +<p> <img src=qmsgbox-m.png> <img src=qmsgbox-w.png> +<p> <p>See also <a href="qdialog.html">TQDialog</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>TQMessageBox::Icon</h3> + +<p> This enum has the following values: +<ul> +<li><tt>TQMessageBox::NoIcon</tt> - the message box does not have any icon. +<li><tt>TQMessageBox::Question</tt> - an icon indicating that +the message is asking a question. +<li><tt>TQMessageBox::Information</tt> - an icon indicating that +the message is nothing out of the ordinary. +<li><tt>TQMessageBox::Warning</tt> - an icon indicating that the +message is a warning, but can be dealt with. +<li><tt>TQMessageBox::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="TQMessageBox"></a>TQMessageBox::TQMessageBox ( <a href="qwidget.html">TQWidget</a> * parent = 0, const char * 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">TQDialog</a> +constructor. + +<h3 class=fn><a name="TQMessageBox-2"></a>TQMessageBox::TQMessageBox ( const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, <a href="qmessagebox.html#Icon-enum">Icon</a> icon, int button0, int button1, int button2, <a href="qwidget.html">TQWidget</a> * parent = 0, const char * name = 0, bool modal = TRUE, WFlags 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> TQMessageBox::NoIcon +<li> TQMessageBox::Question +<li> TQMessageBox::Information +<li> TQMessageBox::Warning +<li> TQMessageBox::Critical +</ul> +<p> Each button, <em>button0</em>, <em>button1</em> and <em>button2</em>, can have one +of the following values: +<ul> +<li> TQMessageBox::NoButton +<li> TQMessageBox::Ok +<li> TQMessageBox::Cancel +<li> TQMessageBox::Yes +<li> TQMessageBox::No +<li> TQMessageBox::Abort +<li> TQMessageBox::Retry +<li> TQMessageBox::Ignore +<li> TQMessageBox::YesAll +<li> TQMessageBox::NoAll +</ul> +<p> Use TQMessageBox::NoButton for the later parameters to have fewer +than three buttons in your message box. If you don't specify any +buttons at all, TQMessageBox will provide an Ok button. +<p> One of the buttons can be OR-ed with the <tt>TQMessageBox::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>TQMessageBox::Escape</tt> +flag to make it the cancel or close button (clicked when Escape is +pressed). +<p> Example: +<pre> + TQMessageBox mb( "Application Name", + "Hardware failure.\n\nDisk error detected\nDo you want to stop?", + TQMessageBox::<a href="#Icon-enum">Question</a>, + TQMessageBox::Yes | TQMessageBox::Default, + TQMessageBox::No | TQMessageBox::Escape, + TQMessageBox::<a href="qt.html#ButtonState-enum">NoButton</a> ); + if ( mb.<a href="qdialog.html#exec">exec</a>() == TQMessageBox::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 box is modal; otherwise it +is 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">TQDialog</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="~TQMessageBox"></a>TQMessageBox::~TQMessageBox () +</h3> +Destroys the message box. + +<h3 class=fn>void <a name="about"></a>TQMessageBox::about ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & 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">TQWidget::icon</a> and <a href="qapplication.html#mainWidget">TQApplication::mainWidget</a>(). + +<p>Examples: <a href="qaction-application-example.html#x1137">action/application.cpp</a>, <a href="simple-application-example.html#x1555">application/application.cpp</a>, <a href="canvas-chart-example.html#x2886">chart/chartform.cpp</a>, <a href="helpviewer-example.html#x994">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2036">mdi/application.cpp</a>, <a href="menu-example.html#x1874">menu/menu.cpp</a>, and <a href="themes-example.html#x330">themes/themes.cpp</a>. +<h3 class=fn>void <a name="aboutTQt"></a>TQMessageBox::aboutTQt ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption = TQString::null )<tt> [static]</tt> +</h3> +Displays a simple message box about TQt, with caption <em>caption</em> +and centered over <em>parent</em> (if <em>parent</em> is not 0). The message +includes the version number of TQt being used by the application. +<p> This is useful for inclusion in the Help menu of an application. +See the examples/menu/menu.cpp example. +<p> <a href="qapplication.html">TQApplication</a> provides this functionality as a slot. +<p> <p>See also <a href="qapplication.html#aboutTQt">TQApplication::aboutTQt</a>(). + +<p>Examples: <a href="qaction-application-example.html#x1138">action/application.cpp</a>, <a href="simple-application-example.html#x1556">application/application.cpp</a>, <a href="canvas-chart-example.html#x2887">chart/chartform.cpp</a>, <a href="helpviewer-example.html#x995">helpviewer/helpwindow.cpp</a>, <a href="menu-example.html#x1875">menu/menu.cpp</a>, <a href="themes-example.html#x331">themes/themes.cpp</a>, and <a href="trivial-nsplugin-example.html#x2736">trivial/trivial.cpp</a>. +<h3 class=fn>void <a name="adjustSize"></a>TQMessageBox::adjustSize ()<tt> [virtual]</tt> +</h3> +Adjusts the size of the message box to fit the contents just before +<a href="qdialog.html#exec">TQDialog::exec</a>() or <a href="qdialog.html#show">TQDialog::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">TQWidget</a>. +<h3 class=fn><a href="qstring.html">TQString</a> <a name="buttonText"></a>TQMessageBox::buttonText ( int button ) const +</h3> +Returns the text of the message box button <em>button</em>, or +<a href="qstring.html#TQString-null">TQString::null</a> 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>TQMessageBox::critical ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, int button0, int button1, int 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> TQMessageBox::NoButton +<li> TQMessageBox::Ok +<li> TQMessageBox::Cancel +<li> TQMessageBox::Yes +<li> TQMessageBox::No +<li> TQMessageBox::Abort +<li> TQMessageBox::Retry +<li> TQMessageBox::Ignore +<li> TQMessageBox::YesAll +<li> TQMessageBox::NoAll +</ul> +<p> If you don't want all three buttons, set the last button, or last +two buttons to TQMessageBox::NoButton. +<p> One button can be OR-ed with <tt>TQMessageBox::Default</tt>, and one +button can be OR-ed with <tt>TQMessageBox::Escape</tt>. +<p> Returns the identity (TQMessageBox::Ok, or TQMessageBox::No, etc.) +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>(), <a href="#question">question</a>(), and <a href="#warning">warning</a>(). + +<p>Examples: <a href="archivesearch-example.html#x478">network/archivesearch/archivedialog.ui.h</a>, <a href="ftpclient-example.html#x767">network/ftpclient/ftpmainwindow.ui.h</a>, <a href="process-example.html#x96">process/process.cpp</a>, and <a href="outliner-example.html#x1917">xml/outliner/outlinetree.cpp</a>. +<h3 class=fn>int <a name="critical-2"></a>TQMessageBox::critical ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, const <a href="qstring.html">TQString</a> & button0Text = TQString::null, const <a href="qstring.html">TQString</a> & button1Text = TQString::null, const <a href="qstring.html">TQString</a> & button2Text = TQString::null, int defaultButtonNumber = 0, int 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, 2 or 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, 1 or 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; +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>(), <a href="#question">question</a>(), and <a href="#warning">warning</a>(). + +<h3 class=fn><a href="qmessagebox.html#Icon-enum">Icon</a> <a name="icon"></a>TQMessageBox::icon () const +</h3><p>Returns the message box's icon. +See the <a href="qmessagebox.html#icon-prop">"icon"</a> property for details. +<h3 class=fn>const <a href="qpixmap.html">TQPixmap</a> * <a name="iconPixmap"></a>TQMessageBox::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>TQMessageBox::information ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, int button0, int button1 = 0, int 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> TQMessageBox::NoButton +<li> TQMessageBox::Ok +<li> TQMessageBox::Cancel +<li> TQMessageBox::Yes +<li> TQMessageBox::No +<li> TQMessageBox::Abort +<li> TQMessageBox::Retry +<li> TQMessageBox::Ignore +<li> TQMessageBox::YesAll +<li> TQMessageBox::NoAll +</ul> +<p> If you don't want all three buttons, set the last button, or last +two buttons to TQMessageBox::NoButton. +<p> One button can be OR-ed with <tt>TQMessageBox::Default</tt>, and one +button can be OR-ed with <tt>TQMessageBox::Escape</tt>. +<p> Returns the identity (TQMessageBox::Ok, or TQMessageBox::No, etc.) +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="#question">question</a>(), <a href="#warning">warning</a>(), and <a href="#critical">critical</a>(). + +<p>Examples: <a href="qaction-application-example.html#x1139">action/application.cpp</a>, <a href="simple-application-example.html#x1557">application/application.cpp</a>, <a href="dirview-example.html#x1695">dirview/dirview.cpp</a>, <a href="fileiconview-example.html#x859">fileiconview/qfileiconview.cpp</a>, <a href="picture-example.html#x110">picture/picture.cpp</a>, <a href="qwerty-example.html#x373">qwerty/qwerty.cpp</a>, and <a href="qaxserver-example-simple.html#x2524">simple/main.cpp</a>. +<h3 class=fn>int <a name="information-2"></a>TQMessageBox::information ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, const <a href="qstring.html">TQString</a> & button0Text = TQString::null, const <a href="qstring.html">TQString</a> & button1Text = TQString::null, const <a href="qstring.html">TQString</a> & button2Text = TQString::null, int defaultButtonNumber = 0, int 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, 1 or 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; +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> Note: If you do not specify an Escape button then if the Escape +button is pressed then -1 will be returned. It is suggested that +you specify an Escape button to prevent this from happening. +<p> <p>See also <a href="#question">question</a>(), <a href="#warning">warning</a>(), and <a href="#critical">critical</a>(). + +<h3 class=fn>int <a name="message"></a>TQMessageBox::message ( const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, const <a href="qstring.html">TQString</a> & buttonText = TQString::null, <a href="qwidget.html">TQWidget</a> * 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>(), <a href="#question">question</a>(), or <a href="#critical">critical</a>() instead. + +<p>Example: <a href="grapher-nsplugin-example.html#x2750">grapher/grapher.cpp</a>. +<h3 class=fn>bool <a name="query"></a>TQMessageBox::query ( const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, const <a href="qstring.html">TQString</a> & yesButtonText = TQString::null, const <a href="qstring.html">TQString</a> & noButtonText = TQString::null, <a href="qwidget.html">TQWidget</a> * 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="#question">question</a>(), <a href="#warning">warning</a>(), or <a href="#critical">critical</a>() instead. + +<h3 class=fn>int <a name="question"></a>TQMessageBox::question ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, int button0, int button1 = 0, int button2 = 0 )<tt> [static]</tt> +</h3> +Opens a question 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> TQMessageBox::NoButton +<li> TQMessageBox::Ok +<li> TQMessageBox::Cancel +<li> TQMessageBox::Yes +<li> TQMessageBox::No +<li> TQMessageBox::Abort +<li> TQMessageBox::Retry +<li> TQMessageBox::Ignore +<li> TQMessageBox::YesAll +<li> TQMessageBox::NoAll +</ul> +<p> If you don't want all three buttons, set the last button, or last +two buttons to TQMessageBox::NoButton. +<p> One button can be OR-ed with <tt>TQMessageBox::Default</tt>, and one +button can be OR-ed with <tt>TQMessageBox::Escape</tt>. +<p> Returns the identity (TQMessageBox::Yes, or TQMessageBox::No, etc.) +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>(), <a href="#warning">warning</a>(), and <a href="#critical">critical</a>(). + +<h3 class=fn>int <a name="question-2"></a>TQMessageBox::question ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, const <a href="qstring.html">TQString</a> & button0Text = TQString::null, const <a href="qstring.html">TQString</a> & button1Text = TQString::null, const <a href="qstring.html">TQString</a> & button2Text = TQString::null, int defaultButtonNumber = 0, int 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 question 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, 1 or 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; +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> Note: If you do not specify an Escape button then if the Escape +button is pressed then -1 will be returned. It is suggested that +you specify an Escape button to prevent this from happening. +<p> <p>See also <a href="#information">information</a>(), <a href="#warning">warning</a>(), and <a href="#critical">critical</a>(). + +<h3 class=fn>void <a name="setButtonText"></a>TQMessageBox::setButtonText ( int button, const <a href="qstring.html">TQString</a> & 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>TQMessageBox::setIcon ( <a href="qmessagebox.html#Icon-enum">Icon</a> ) +</h3><p>Sets the message box's icon. +See the <a href="qmessagebox.html#icon-prop">"icon"</a> property for details. +<h3 class=fn>void <a name="setIconPixmap"></a>TQMessageBox::setIconPixmap ( const <a href="qpixmap.html">TQPixmap</a> & ) +</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>TQMessageBox::setText ( const <a href="qstring.html">TQString</a> & ) +</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>TQMessageBox::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">TQPixmap</a> <a name="standardIcon"></a>TQMessageBox::standardIcon ( <a href="qmessagebox.html#Icon-enum">Icon</a> 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 retquired icon, e.g. TQMessageBox::Question, +TQMessageBox::Information, TQMessageBox::Warning or +TQMessageBox::Critical. + +<h3 class=fn><a href="qpixmap.html">TQPixmap</a> <a name="standardIcon-2"></a>TQMessageBox::standardIcon ( <a href="qmessagebox.html#Icon-enum">Icon</a> icon, <a href="qt.html#GUIStyle-enum">GUIStyle</a> 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 retquired icon, e.g. TQMessageBox::Information, +TQMessageBox::Warning or TQMessageBox::Critical. +<p> <em>style</em> is unused. + +<h3 class=fn><a href="qstring.html">TQString</a> <a name="text"></a>TQMessageBox::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>TQMessageBox::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>TQMessageBox::warning ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, int button0, int button1, int 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> TQMessageBox::NoButton +<li> TQMessageBox::Ok +<li> TQMessageBox::Cancel +<li> TQMessageBox::Yes +<li> TQMessageBox::No +<li> TQMessageBox::Abort +<li> TQMessageBox::Retry +<li> TQMessageBox::Ignore +<li> TQMessageBox::YesAll +<li> TQMessageBox::NoAll +</ul> +<p> If you don't want all three buttons, set the last button, or last +two buttons to TQMessageBox::NoButton. +<p> One button can be OR-ed with <tt>TQMessageBox::Default</tt>, and one +button can be OR-ed with <tt>TQMessageBox::Escape</tt>. +<p> Returns the identity (TQMessageBox::Ok, or TQMessageBox::No, etc.) +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>(), <a href="#question">question</a>(), and <a href="#critical">critical</a>(). + +<p>Examples: <a href="tutorial2-05.html#x2566">chart/chartform.cpp</a>, <a href="i18n-example.html#x1940">i18n/main.cpp</a>, <a href="mail-example.html#x708">network/mail/smtp.cpp</a>, <a href="qwerty-example.html#x374">qwerty/qwerty.cpp</a>, <a href="showimg-example.html#x1333">showimg/showimg.cpp</a>, and <a href="sound-example.html#x2812">sound/sound.cpp</a>. +<h3 class=fn>int <a name="warning-2"></a>TQMessageBox::warning ( <a href="qwidget.html">TQWidget</a> * parent, const <a href="qstring.html">TQString</a> & caption, const <a href="qstring.html">TQString</a> & text, const <a href="qstring.html">TQString</a> & button0Text = TQString::null, const <a href="qstring.html">TQString</a> & button1Text = TQString::null, const <a href="qstring.html">TQString</a> & button2Text = TQString::null, int defaultButtonNumber = 0, int 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, 2 or +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, 1 or 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; +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> Note: If you do not specify an Escape button then if the Escape +button is pressed then -1 will be returned. It is suggested that +you specify an Escape button to prevent this from happening. +<p> <p>See also <a href="#information">information</a>(), <a href="#question">question</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 message box's icon. +<p>The icon of the message box can be one of the following predefined +icons: +<ul> +<li> TQMessageBox::NoIcon +<li> TQMessageBox::Question +<li> TQMessageBox::Information +<li> TQMessageBox::Warning +<li> TQMessageBox::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">TQMessageBox::iconPixmap</a> +property. The default icon is TQMessageBox::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">TQPixmap</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 <a href="motif-extension.html#Motif">Motif</a> 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">TQString</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 rich +text, depending on the text format setting (<a href="#textFormat-prop">TQMessageBox::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 this property is <a href="qstring.html#TQString-null">TQString::null</a>. +<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">TQt::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">TQt toolkit</a>. +Copyright © 1995-2007 +<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 © 2007 +<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> +<td align=right><div align=right>TQt 3.3.8</div> +</table></div></address></body> +</html> |