summaryrefslogtreecommitdiffstats
path: root/doc/html/qmessagebox.html
blob: 7bb48512b48057841f3198df5cc5eb54f77a2afc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
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>QMessageBox 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&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 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="#QMessageBox"><b>QMessageBox</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li 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 )</li>
<li class=fn><a href="#~QMessageBox"><b>~QMessageBox</b></a> ()</li>
<li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
<li class=fn>void <a href="#setText"><b>setText</b></a> ( const QString &amp; )</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 QPixmap * <a href="#iconPixmap"><b>iconPixmap</b></a> () const</li>
<li class=fn>void <a href="#setIconPixmap"><b>setIconPixmap</b></a> ( const QPixmap &amp; )</li>
<li class=fn>QString <a href="#buttonText"><b>buttonText</b></a> ( int&nbsp;button ) const</li>
<li class=fn>void <a href="#setButtonText"><b>setButtonText</b></a> ( int&nbsp;button, const&nbsp;QString&nbsp;&amp;&nbsp;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> ( 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 )</li>
<li 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 )</li>
<li class=fn>int <a href="#question"><b>question</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 )</li>
<li class=fn>int <a href="#question-2"><b>question</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 )</li>
<li 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 )</li>
<li 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 )</li>
<li 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 )</li>
<li 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 )</li>
<li 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 )</li>
<li class=fn>void <a href="#aboutQt"><b>aboutQt</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null )</li>
<li 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></li>
<li 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></li>
<li class=fn>QPixmap standardIcon ( Icon&nbsp;icon, GUIStyle&nbsp;style ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>QPixmap <a href="#standardIcon"><b>standardIcon</b></a> ( Icon&nbsp;icon )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>Icon <a href="#icon-prop"><b>icon</b></a>&nbsp;- the message box's icon</li>
<li class=fn>QPixmap <a href="#iconPixmap-prop"><b>iconPixmap</b></a>&nbsp;- the current icon</li>
<li class=fn>QString <a href="#text-prop"><b>text</b></a>&nbsp;- the message box text to be displayed</li>
<li class=fn>TextFormat <a href="#textFormat-prop"><b>textFormat</b></a>&nbsp;- the format of the text displayed by the message box</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> Message boxes are used to provide informative messages and to ask
simple questions.
<p> QMessageBox 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>
    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="#question">question</a>() is useful for simple yes/no questions:
<p> <pre>
    if ( QFile::<a href="qfile.html#exists">exists</a>( filename ) &amp;&amp;
        QMessageBox::<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>("&amp;Yes"), tr("&amp;No"),
            <a href="qstring.html#QString-null">QString::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( 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> 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( 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 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( 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 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> 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 1991-2003 Such-and-such. "
        "&lt;License words here.&gt;\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
Qt (so they know that you use high quality tools) you might like
to add an "About Qt" menu option under the Help menu to invoke
<a href="#aboutQt">aboutQt</a>().
<p> If none of the standard message boxes is suitable, you can create a
QMessageBox from scratch and use 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.<a href="#setButtonText">setButtonText</a>( QMessageBox::Yes, "Save" );
    mb.<a href="#setButtonText">setButtonText</a>( QMessageBox::No, "Discard" );
    switch( mb.<a href="qdialog.html#exec">exec</a>() ) {
    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">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
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 has the following values:
<ul>
<li><tt>QMessageBox::NoIcon</tt> - the message box does not have any icon.
<li><tt>QMessageBox::Question</tt> - an icon indicating that
the message is asking a question.
<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::Question
<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
<li> QMessageBox::YesAll
<li> QMessageBox::NoAll
</ul>
<p> Use QMessageBox::NoButton for the later parameters to have fewer
than three buttons in your message box. If you don't specify any
buttons at all, QMessageBox will provide an Ok button.
<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">Question</a>,
        QMessageBox::Yes | QMessageBox::Default,
        QMessageBox::No  | QMessageBox::Escape,
        QMessageBox::<a href="qt.html#ButtonState-enum">NoButton</a> );
    if ( mb.<a href="qdialog.html#exec">exec</a>() == 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 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">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#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="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 centered over <em>parent</em> (if <em>parent</em> is not 0). The message
includes the version number of Qt 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">QApplication</a> provides this functionality as a slot.
<p> <p>See also <a href="qapplication.html#aboutQt">QApplication::aboutQt</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>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 message box button <em>button</em>, or
<a href="qstring.html#QString-null">QString::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>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
<li> QMessageBox::YesAll
<li> QMessageBox::NoAll
</ul>
<p> If you don't want all three buttons, set the last button, or last
two buttons to QMessageBox::NoButton.
<p> One button can be OR-ed with <tt>QMessageBox::Default</tt>, and one
button can be OR-ed with <tt>QMessageBox::Escape</tt>.
<p> Returns the identity (QMessageBox::Ok, or QMessageBox::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>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, 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>QMessageBox::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&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
<li> QMessageBox::YesAll
<li> QMessageBox::NoAll
</ul>
<p> If you don't want all three buttons, set the last button, or last
two buttons to QMessageBox::NoButton.
<p> One button can be OR-ed with <tt>QMessageBox::Default</tt>, and one
button can be OR-ed with <tt>QMessageBox::Escape</tt>.
<p> Returns the identity (QMessageBox::Ok, or QMessageBox::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>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, 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>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>(), <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>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="#question">question</a>(), <a href="#warning">warning</a>(), or <a href="#critical">critical</a>() instead.

<h3 class=fn>int <a name="question"></a>QMessageBox::question ( <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 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> QMessageBox::NoButton
<li> QMessageBox::Ok
<li> QMessageBox::Cancel
<li> QMessageBox::Yes
<li> QMessageBox::No
<li> QMessageBox::Abort
<li> QMessageBox::Retry
<li> QMessageBox::Ignore
<li> QMessageBox::YesAll
<li> QMessageBox::NoAll
</ul>
<p> If you don't want all three buttons, set the last button, or last
two buttons to QMessageBox::NoButton.
<p> One button can be OR-ed with <tt>QMessageBox::Default</tt>, and one
button can be OR-ed with <tt>QMessageBox::Escape</tt>.
<p> Returns the identity (QMessageBox::Yes, or QMessageBox::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>QMessageBox::question ( <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 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>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 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>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::Question,
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
<li> QMessageBox::YesAll
<li> QMessageBox::NoAll
</ul>
<p> If you don't want all three buttons, set the last button, or last
two buttons to QMessageBox::NoButton.
<p> One button can be OR-ed with <tt>QMessageBox::Default</tt>, and one
button can be OR-ed with <tt>QMessageBox::Escape</tt>.
<p> Returns the identity (QMessageBox::Ok, or QMessageBox::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>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, 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> QMessageBox::NoIcon
<li> QMessageBox::Question
<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 <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">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 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 this property is <a href="qstring.html#QString-null">QString::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">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-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 &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>