1QMessageBox(3qt)                                              QMessageBox(3qt)
2
3
4

NAME

6       QMessageBox - Modal dialog with a short message, an icon, and some
7       buttons
8

SYNOPSIS

10       #include <qmessagebox.h>
11
12       Inherits QDialog.
13
14   Public Members
15       enum Icon { NoIcon = 0, Information = 1, Warning = 2, Critical = 3,
16           Question = 4 }
17       QMessageBox ( QWidget * parent = 0, const char * name = 0 )
18       QMessageBox ( const QString & caption, const QString & text, Icon icon,
19           int button0, int button1, int button2, QWidget * parent = 0, const
20           char * name = 0, bool modal = TRUE, WFlags f = WStyle_DialogBorder
21           )
22       ~QMessageBox ()
23       QString text () const
24       void setText ( const QString & )
25       Icon icon () const
26       void setIcon ( Icon )
27       const QPixmap * iconPixmap () const
28       void setIconPixmap ( const QPixmap & )
29       QString buttonText ( int button ) const
30       void setButtonText ( int button, const QString & text )
31       virtual void adjustSize ()
32       TextFormat textFormat () const
33       void setTextFormat ( TextFormat )
34
35   Static Public Members
36       int information ( QWidget * parent, const QString & caption, const
37           QString & text, int button0, int button1 = 0, int button2 = 0 )
38       int information ( QWidget * parent, const QString & caption, const
39           QString & text, const QString & button0Text = QString::null, const
40           QString & button1Text = QString::null, const QString & button2Text
41           = QString::null, int defaultButtonNumber = 0, int
42           escapeButtonNumber = -1 )
43       int question ( QWidget * parent, const QString & caption, const QString
44           & text, int button0, int button1 = 0, int button2 = 0 )
45       int question ( QWidget * parent, const QString & caption, const QString
46           & text, const QString & button0Text = QString::null, const QString
47           & button1Text = QString::null, const QString & button2Text =
48           QString::null, int defaultButtonNumber = 0, int escapeButtonNumber
49           = -1 )
50       int warning ( QWidget * parent, const QString & caption, const QString
51           & text, int button0, int button1, int button2 = 0 )
52       int warning ( QWidget * parent, const QString & caption, const QString
53           & text, const QString & button0Text = QString::null, const QString
54           & button1Text = QString::null, const QString & button2Text =
55           QString::null, int defaultButtonNumber = 0, int escapeButtonNumber
56           = -1 )
57       int critical ( QWidget * parent, const QString & caption, const QString
58           & text, int button0, int button1, int button2 = 0 )
59       int critical ( QWidget * parent, const QString & caption, const QString
60           & text, const QString & button0Text = QString::null, const QString
61           & button1Text = QString::null, const QString & button2Text =
62           QString::null, int defaultButtonNumber = 0, int escapeButtonNumber
63           = -1 )
64       void about ( QWidget * parent, const QString & caption, const QString &
65           text )
66       void aboutQt ( QWidget * parent, const QString & caption =
67           QString::null )
68       int message ( const QString & caption, const QString & text, const
69           QString & buttonText = QString::null, QWidget * parent = 0, const
70           char * = 0 )  (obsolete)
71       bool query ( const QString & caption, const QString & text, const
72           QString & yesButtonText = QString::null, const QString &
73           noButtonText = QString::null, QWidget * parent = 0, const char * =
74           0 )  (obsolete)
75       QPixmap standardIcon ( Icon icon, GUIStyle style )  (obsolete)
76       QPixmap standardIcon ( Icon icon )
77
78   Properties
79       Icon icon - the message box's icon
80       QPixmap iconPixmap - the current icon
81       QString text - the message box text to be displayed
82       TextFormat textFormat - the format of the text displayed by the message
83           box
84

DESCRIPTION

86       The QMessageBox class provides a modal dialog with a short message, an
87       icon, and some buttons.
88
89       Message boxes are used to provide informative messages and to ask
90       simple questions.
91
92       QMessageBox provides a range of different messages, arranged roughly
93       along two axes: severity and complexity.
94
95       Severity is <center>.nf
96
97       </center>
98
99       The message box has a different icon for each of the severity levels.
100
101       Complexity is one button (OK) for simple messages, or two or even three
102       buttons for questions.
103
104       There are static functions for the most common cases.
105
106       Examples:
107
108       If a program is unable to find a supporting file, but can do perfectly
109       well without it:
110
111           QMessageBox::information( this, "Application name",
112           "Unable to find the user preferences file.\n"
113           "The factory default will be used instead." );
114
115       question() is useful for simple yes/no questions:
116
117           if ( QFile::exists( filename ) &&
118               QMessageBox::question(
119                   this,
120                   tr("Overwrite File? -- Application Name"),
121                   tr("A file called %1 already exists."
122                       "Do you want to overwrite it?")
123                       .arg( filename ),
124                   tr("&Yes"), tr("&No"),
125                   QString::null, 0, 1 ) )
126               return false;
127
128       warning() can be used to tell the user about unusual errors, or errors
129       which can't be easily fixed:
130
131           switch( QMessageBox::warning( this, "Application name",
132               "Could not connect to the <mumble> server.\n"
133               "This program can't function correctly "
134               "without the server.\n\n",
135               "Retry",
136               "Quit", 0, 0, 1 ) ) {
137           case 0: // The user clicked the Retry again button or pressed Enter
138               // try again
139               break;
140           case 1: // The user clicked the Quit or pressed Escape
141               // exit
142               break;
143           }
144
145       The text part of all message box messages can be either rich text or
146       plain text. If you specify a rich text formatted string, it will be
147       rendered using the default stylesheet. See QStyleSheet::defaultSheet()
148       for details. With certain strings that contain XML meta characters, the
149       auto-rich text detection may fail, interpreting plain text incorrectly
150       as rich text. In these rare cases, use
151       QStyleSheet::convertFromPlainText() to convert your plain text string
152       to a visually equivalent rich text string or set the text format
153       explicitly with setTextFormat().
154
155       Note that the Microsoft Windows User Interface Guidelines recommend
156       using the application name as the window's caption.
157
158       Below are more examples of how to use the static member functions.
159       After these examples you will find an overview of the non-static member
160       functions.
161
162       Exiting a program is part of its normal operation. If there is unsaved
163       data the user probably should be asked if they want to save the data.
164       For example:
165
166           switch( QMessageBox::information( this, "Application name here",
167               "The document contains unsaved changes\n"
168               "Do you want to save the changes before exiting?",
169               "&Save", "&Discard", "Cancel",
170               0,      // Enter == button 0
171               2 ) ) { // Escape == button 2
172           case 0: // Save clicked or Alt+S pressed or Enter pressed.
173               // save
174               break;
175           case 1: // Discard clicked or Alt+D pressed
176               // don't save but exit
177               break;
178           case 2: // Cancel clicked or Escape pressed
179               // don't exit
180               break;
181           }
182
183       The Escape button cancels the entire exit operation, and pressing Enter
184       causes the changes to be saved before the exit occurs.
185
186       Disk full errors are unusual and they certainly can be hard to correct.
187       This example uses predefined buttons instead of hard-coded button
188       texts:
189
190           switch( QMessageBox::warning( this, "Application name here",
191               "Could not save the user preferences,\n"
192               "because the disk is full. You can delete\n"
193               "some files and press Retry, or you can\n"
194               "abort the Save Preferences operation.",
195               QMessageBox::Retry | QMessageBox::Default,
196               QMessageBox::Abort | QMessageBox::Escape )) {
197           case QMessageBox::Retry: // Retry clicked or Enter pressed
198               // try again
199               break;
200           case QMessageBox::Abort: // Abort clicked or Escape pressed
201               // abort
202               break;
203           }
204
205       The critical() function should be reserved for critical errors. In this
206       example errorDetails is a QString or const char*, and QString is used
207       to concatenate several strings:
208
209           QMessageBox::critical( 0, "Application name here",
210               QString("An internal error occurred. Please ") +
211               "call technical support at 1234-56789 and report\n"+
212               "these numbers:\n\n" + errorDetails +
213               "\n\nApplication will now exit." );
214
215       In this example an OK button is displayed.
216
217       QMessageBox provides a very simple About box which displays an
218       appropriate icon and the string you provide:
219
220           QMessageBox::about( this, "About <Application>",
221               "<Application> is a <one-paragraph blurb>\n\n"
222               "Copyright 1991-2003 Such-and-such. "
223               "<License words here.>\n\n"
224               "For technical support, call 1234-56789 or see\n"
225               "http://www.such-and-such.com/Application/\n" );
226
227       See about() for more information.
228
229       If you want your users to know that the application is built using Qt
230       (so they know that you use high quality tools) you might like to add an
231       "About Qt" menu option under the Help menu to invoke aboutQt().
232
233       If none of the standard message boxes is suitable, you can create a
234       QMessageBox from scratch and use custom button texts:
235
236           QMessageBox mb( "Application name here",
237               "Saving the file will overwrite the original file on the disk.\n"
238               "Do you really want to save?",
239               QMessageBox::Information,
240               QMessageBox::Yes | QMessageBox::Default,
241               QMessageBox::No,
242               QMessageBox::Cancel | QMessageBox::Escape );
243           mb.setButtonText( QMessageBox::Yes, "Save" );
244           mb.setButtonText( QMessageBox::No, "Discard" );
245           switch( mb.exec() ) {
246           case QMessageBox::Yes:
247               // save and exit
248               break;
249           case QMessageBox::No:
250               // exit without saving
251               break;
252           case QMessageBox::Cancel:
253               // don't save and don't exit
254               break;
255           }
256
257       QMessageBox defines two enum types: Icon and an unnamed button type.
258       Icon defines the Question, Information, Warning, and Critical icons for
259       each GUI style. It is used by the constructor and by the static member
260       functions question(), information(), warning() and critical(). A
261       function called standardIcon() gives you access to the various icons.
262
263       The button types are:
264
265       Ok - the default for single-button message boxes
266
267       Cancel - note that this is not automatically Escape
268
269       Yes
270
271       No
272
273       Abort
274
275       Retry
276
277       Ignore
278
279       YesAll
280
281       NoAll
282
283       Button types can be combined with two modifiers by using OR, '|':
284
285       Default - makes pressing Enter equivalent to clicking this button.
286       Normally used with Ok, Yes or similar.
287
288       Escape - makes pressing Escape equivalent to clicking this button.
289       Normally used with Abort, Cancel or similar.
290
291       The text(), icon() and iconPixmap() functions provide access to the
292       current text and pixmap of the message box. The setText(), setIcon()
293       and setIconPixmap() let you change it. The difference between setIcon()
294       and setIconPixmap() is that the former accepts a QMessageBox::Icon and
295       can be used to set standard icons, whereas the latter accepts a QPixmap
296       and can be used to set custom icons.
297
298       setButtonText() and buttonText() provide access to the buttons.
299
300       QMessageBox has no signals or slots.
301
302                                   [Image Omitted]
303
304                                   [Image Omitted]
305
306       See also QDialog, Isys on error messages, GUI Design Handbook: Message
307       Box, and Dialog Classes.
308
309   Member Type Documentation

QMessageBox::Icon

311       This enum has the following values:
312
313       QMessageBox::NoIcon - the message box does not have any icon.
314
315       QMessageBox::Question - an icon indicating that the message is asking a
316       question.
317
318       QMessageBox::Information - an icon indicating that the message is
319       nothing out of the ordinary.
320
321       QMessageBox::Warning - an icon indicating that the message is a
322       warning, but can be dealt with.
323
324       QMessageBox::Critical - an icon indicating that the message represents
325       a critical problem.
326

MEMBER FUNCTION DOCUMENTATION

QMessageBox::QMessageBox ( QWidget * parent = 0, const char * name = 0 )

329       Constructs a message box with no text and a button with the label" OK".
330
331       If parent is 0, the message box becomes an application-global modal
332       dialog box. If parent is a widget, the message box becomes modal
333       relative to parent.
334
335       The parent and name arguments are passed to the QDialog constructor.
336

QMessageBox::QMessageBox ( const QString & caption, const QString & text, Icon

338       icon, int button0, int button1, int button2, QWidget * parent = 0,
339       const char * name = 0, bool modal = TRUE, WFlags f =
340       WStyle_DialogBorder )
341       Constructs a message box with a caption, a text, an icon, and up to
342       three buttons.
343
344       The icon must be one of the following:
345
346       QMessageBox::NoIcon
347
348       QMessageBox::Question
349
350       QMessageBox::Information
351
352       QMessageBox::Warning
353
354       QMessageBox::Critical
355
356       Each button, button0, button1 and button2, can have one of the
357       following values:
358
359       QMessageBox::NoButton
360
361       QMessageBox::Ok
362
363       QMessageBox::Cancel
364
365       QMessageBox::Yes
366
367       QMessageBox::No
368
369       QMessageBox::Abort
370
371       QMessageBox::Retry
372
373       QMessageBox::Ignore
374
375       QMessageBox::YesAll
376
377       QMessageBox::NoAll
378
379       Use QMessageBox::NoButton for the later parameters to have fewer than
380       three buttons in your message box. If you don't specify any buttons at
381       all, QMessageBox will provide an Ok button.
382
383       One of the buttons can be OR-ed with the QMessageBox::Default flag to
384       make it the default button (clicked when Enter is pressed).
385
386       One of the buttons can be OR-ed with the QMessageBox::Escape flag to
387       make it the cancel or close button (clicked when Escape is pressed).
388
389       Example:
390
391           QMessageBox mb( "Application Name",
392               "Hardware failure.\n\nDisk error detected\nDo you want to stop?",
393               QMessageBox::Question,
394               QMessageBox::Yes | QMessageBox::Default,
395               QMessageBox::No  | QMessageBox::Escape,
396               QMessageBox::NoButton );
397           if ( mb.exec() == QMessageBox::No )
398               // try again
399
400       If parent is 0, the message box becomes an application-global modal
401       dialog box. If parent is a widget, the message box becomes modal
402       relative to parent.
403
404       If modal is TRUE the message box is modal; otherwise it is modeless.
405
406       The parent, name, modal, and f arguments are passed to the QDialog
407       constructor.
408
409       See also caption, text, and icon.
410

QMessageBox::~QMessageBox ()

412       Destroys the message box.
413

void QMessageBox::about ( QWidget * parent, const QString & caption, const

415       QString & text ) [static]
416       Displays a simple about box with caption caption and text text. The
417       about box's parent is parent.
418
419       about() looks for a suitable icon in four locations: <ol type=1>
420
421       It prefers parent->icon() if that exists.
422
423       If not, it tries the top-level widget containing parent.
424
425       If that fails, it tries the main widget.
426
427       As a last resort it uses the Information icon.
428
429       The about box has a single button labelled "OK".
430
431       See also QWidget::icon and QApplication::mainWidget().
432
433       Examples:
434

void QMessageBox::aboutQt ( QWidget * parent, const QString & caption =

436       QString::null ) [static]
437       Displays a simple message box about Qt, with caption caption and
438       centered over parent (if parent is not 0). The message includes the
439       version number of Qt being used by the application.
440
441       This is useful for inclusion in the Help menu of an application. See
442       the examples/menu/menu.cpp example.
443
444       QApplication provides this functionality as a slot.
445
446       See also QApplication::aboutQt().
447
448       Examples:
449

void QMessageBox::adjustSize () [virtual]

451       Adjusts the size of the message box to fit the contents just before
452       QDialog::exec() or QDialog::show() is called.
453
454       This function will not be called if the message box has been explicitly
455       resized before showing it.
456
457       Reimplemented from QWidget.
458

QString QMessageBox::buttonText ( int button ) const

460       Returns the text of the message box button button, or QString::null if
461       the message box does not contain the button.
462
463       See also setButtonText().
464

int QMessageBox::critical ( QWidget * parent, const QString & caption, const

466       QString & text, int button0, int button1, int button2 = 0 ) [static]
467       Opens a critical message box with the caption caption and the text
468       text. The dialog may have up to three buttons. Each of the button
469       parameters, button0, button1 and button2 may be set to one of the
470       following values:
471
472       QMessageBox::NoButton
473
474       QMessageBox::Ok
475
476       QMessageBox::Cancel
477
478       QMessageBox::Yes
479
480       QMessageBox::No
481
482       QMessageBox::Abort
483
484       QMessageBox::Retry
485
486       QMessageBox::Ignore
487
488       QMessageBox::YesAll
489
490       QMessageBox::NoAll
491
492       If you don't want all three buttons, set the last button, or last two
493       buttons to QMessageBox::NoButton.
494
495       One button can be OR-ed with QMessageBox::Default, and one button can
496       be OR-ed with QMessageBox::Escape.
497
498       Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) of the
499       button that was clicked.
500
501       If parent is 0, the message box becomes an application-global modal
502       dialog box. If parent is a widget, the message box becomes modal
503       relative to parent.
504
505       See also information(), question(), and warning().
506
507       Examples:
508

int QMessageBox::critical ( QWidget * parent, const QString & caption, const

510       QString & text, const QString & button0Text = QString::null, const
511       QString & button1Text = QString::null, const QString & button2Text =
512       QString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1
513       ) [static]
514       This is an overloaded member function, provided for convenience. It
515       behaves essentially like the above function.
516
517       Displays a critical error message box with a caption, a text, and 1, 2
518       or 3 buttons. Returns the number of the button that was clicked (0, 1
519       or 2).
520
521       button0Text is the text of the first button, and is optional. If
522       button0Text is not supplied, "OK" (translated) will be used.
523       button1Text is the text of the second button, and is optional, and
524       button2Text is the text of the third button, and is optional.
525       defaultButtonNumber (0, 1 or 2) is the index of the default button;
526       pressing Return or Enter is the same as clicking the default button. It
527       defaults to 0 (the first button). escapeButtonNumber is the index of
528       the Escape button; pressing Escape is the same as clicking this button.
529       It defaults to -1; supply 0, 1, or 2 to make pressing Escape equivalent
530       to clicking the relevant button.
531
532       If parent is 0, the message box becomes an application-global modal
533       dialog box. If parent is a widget, the message box becomes modal
534       relative to parent.
535
536       See also information(), question(), and warning().
537

Icon QMessageBox::icon () const

539       Returns the message box's icon. See the "icon" property for details.
540

const QPixmap * QMessageBox::iconPixmap () const

542       Returns the current icon. See the "iconPixmap" property for details.
543

int QMessageBox::information ( QWidget * parent, const QString & caption,

545       const QString & text, int button0, int button1 = 0, int button2 = 0 )
546       [static]
547       Opens an information message box with the caption caption and the text
548       text. The dialog may have up to three buttons. Each of the buttons,
549       button0, button1 and button2 may be set to one of the following values:
550
551       QMessageBox::NoButton
552
553       QMessageBox::Ok
554
555       QMessageBox::Cancel
556
557       QMessageBox::Yes
558
559       QMessageBox::No
560
561       QMessageBox::Abort
562
563       QMessageBox::Retry
564
565       QMessageBox::Ignore
566
567       QMessageBox::YesAll
568
569       QMessageBox::NoAll
570
571       If you don't want all three buttons, set the last button, or last two
572       buttons to QMessageBox::NoButton.
573
574       One button can be OR-ed with QMessageBox::Default, and one button can
575       be OR-ed with QMessageBox::Escape.
576
577       Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) of the
578       button that was clicked.
579
580       If parent is 0, the message box becomes an application-global modal
581       dialog box. If parent is a widget, the message box becomes modal
582       relative to parent.
583
584       See also question(), warning(), and critical().
585
586       Examples:
587

int QMessageBox::information ( QWidget * parent, const QString & caption,

589       const QString & text, const QString & button0Text = QString::null,
590       const QString & button1Text = QString::null, const QString &
591       button2Text = QString::null, int defaultButtonNumber = 0, int
592       escapeButtonNumber = -1 ) [static]
593       This is an overloaded member function, provided for convenience. It
594       behaves essentially like the above function.
595
596       Displays an information message box with caption caption, text text and
597       one, two or three buttons. Returns the index of the button that was
598       clicked (0, 1 or 2).
599
600       button0Text is the text of the first button, and is optional. If
601       button0Text is not supplied, "OK" (translated) will be used.
602       button1Text is the text of the second button, and is optional.
603       button2Text is the text of the third button, and is optional.
604       defaultButtonNumber (0, 1 or 2) is the index of the default button;
605       pressing Return or Enter is the same as clicking the default button. It
606       defaults to 0 (the first button). escapeButtonNumber is the index of
607       the Escape button; pressing Escape is the same as clicking this button.
608       It defaults to -1; supply 0, 1 or 2 to make pressing Escape equivalent
609       to clicking the relevant button.
610
611       If parent is 0, the message box becomes an application-global modal
612       dialog box. If parent is a widget, the message box becomes modal
613       relative to parent.
614
615       Note: If you do not specify an Escape button then if the Escape button
616       is pressed then -1 will be returned. It is suggested that you specify
617       an Escape button to prevent this from happening.
618
619       See also question(), warning(), and critical().
620

int QMessageBox::message ( const QString & caption, const QString & text,

622       const QString & buttonText = QString::null, QWidget * parent = 0, const
623       char * = 0 ) [static]
624       This function is obsolete. It is provided to keep old source working.
625       We strongly advise against using it in new code.
626
627       Opens a modal message box directly using the specified parameters.
628
629       Please use information(), warning(), question(), or critical() instead.
630
631       Example: grapher/grapher.cpp.
632

bool QMessageBox::query ( const QString & caption, const QString & text, const

634       QString & yesButtonText = QString::null, const QString & noButtonText =
635       QString::null, QWidget * parent = 0, const char * = 0 ) [static]
636       This function is obsolete. It is provided to keep old source working.
637       We strongly advise against using it in new code.
638
639       Queries the user using a modal message box with two buttons. Note that
640       caption is not always shown, it depends on the window manager.
641
642       Please use information(), question(), warning(), or critical() instead.
643

int QMessageBox::question ( QWidget * parent, const QString & caption, const

645       QString & text, int button0, int button1 = 0, int button2 = 0 )
646       [static]
647       Opens a question message box with the caption caption and the text
648       text. The dialog may have up to three buttons. Each of the buttons,
649       button0, button1 and button2 may be set to one of the following values:
650
651       QMessageBox::NoButton
652
653       QMessageBox::Ok
654
655       QMessageBox::Cancel
656
657       QMessageBox::Yes
658
659       QMessageBox::No
660
661       QMessageBox::Abort
662
663       QMessageBox::Retry
664
665       QMessageBox::Ignore
666
667       QMessageBox::YesAll
668
669       QMessageBox::NoAll
670
671       If you don't want all three buttons, set the last button, or last two
672       buttons to QMessageBox::NoButton.
673
674       One button can be OR-ed with QMessageBox::Default, and one button can
675       be OR-ed with QMessageBox::Escape.
676
677       Returns the identity (QMessageBox::Yes, or QMessageBox::No, etc.) of
678       the button that was clicked.
679
680       If parent is 0, the message box becomes an application-global modal
681       dialog box. If parent is a widget, the message box becomes modal
682       relative to parent.
683
684       See also information(), warning(), and critical().
685

int QMessageBox::question ( QWidget * parent, const QString & caption, const

687       QString & text, const QString & button0Text = QString::null, const
688       QString & button1Text = QString::null, const QString & button2Text =
689       QString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1
690       ) [static]
691       This is an overloaded member function, provided for convenience. It
692       behaves essentially like the above function.
693
694       Displays a question message box with caption caption, text text and
695       one, two or three buttons. Returns the index of the button that was
696       clicked (0, 1 or 2).
697
698       button0Text is the text of the first button, and is optional. If
699       button0Text is not supplied, "OK" (translated) will be used.
700       button1Text is the text of the second button, and is optional.
701       button2Text is the text of the third button, and is optional.
702       defaultButtonNumber (0, 1 or 2) is the index of the default button;
703       pressing Return or Enter is the same as clicking the default button. It
704       defaults to 0 (the first button). escapeButtonNumber is the index of
705       the Escape button; pressing Escape is the same as clicking this button.
706       It defaults to -1; supply 0, 1 or 2 to make pressing Escape equivalent
707       to clicking the relevant button.
708
709       If parent is 0, the message box becomes an application-global modal
710       dialog box. If parent is a widget, the message box becomes modal
711       relative to parent.
712
713       Note: If you do not specify an Escape button then if the Escape button
714       is pressed then -1 will be returned. It is suggested that you specify
715       an Escape button to prevent this from happening.
716
717       See also information(), warning(), and critical().
718

void QMessageBox::setButtonText ( int button, const QString & text )

720       Sets the text of the message box button button to text. Setting the
721       text of a button that is not in the message box is silently ignored.
722
723       See also buttonText().
724

void QMessageBox::setIcon ( Icon )

726       Sets the message box's icon. See the "icon" property for details.
727

void QMessageBox::setIconPixmap ( const QPixmap & )

729       Sets the current icon. See the "iconPixmap" property for details.
730

void QMessageBox::setText ( const QString & )

732       Sets the message box text to be displayed. See the "text" property for
733       details.
734

void QMessageBox::setTextFormat ( TextFormat )

736       Sets the format of the text displayed by the message box. See the
737       "textFormat" property for details.
738

QPixmap QMessageBox::standardIcon ( Icon icon ) [static]

740       Returns the pixmap used for a standard icon. This allows the pixmaps to
741       be used in more complex message boxes. icon specifies the required
742       icon, e.g. QMessageBox::Question, QMessageBox::Information,
743       QMessageBox::Warning or QMessageBox::Critical.
744

QPixmap QMessageBox::standardIcon ( Icon icon, GUIStyle style ) [static]

746       This function is obsolete. It is provided to keep old source working.
747       We strongly advise against using it in new code.
748
749       Returns the pixmap used for a standard icon. This allows the pixmaps to
750       be used in more complex message boxes. icon specifies the required
751       icon, e.g. QMessageBox::Information, QMessageBox::Warning or
752       QMessageBox::Critical.
753
754       style is unused.
755

QString QMessageBox::text () const

757       Returns the message box text to be displayed. See the "text" property
758       for details.
759

TextFormat QMessageBox::textFormat () const

761       Returns the format of the text displayed by the message box. See the
762       "textFormat" property for details.
763

int QMessageBox::warning ( QWidget * parent, const QString & caption, const

765       QString & text, int button0, int button1, int button2 = 0 ) [static]
766       Opens a warning message box with the caption caption and the text text.
767       The dialog may have up to three buttons. Each of the button parameters,
768       button0, button1 and button2 may be set to one of the following values:
769
770       QMessageBox::NoButton
771
772       QMessageBox::Ok
773
774       QMessageBox::Cancel
775
776       QMessageBox::Yes
777
778       QMessageBox::No
779
780       QMessageBox::Abort
781
782       QMessageBox::Retry
783
784       QMessageBox::Ignore
785
786       QMessageBox::YesAll
787
788       QMessageBox::NoAll
789
790       If you don't want all three buttons, set the last button, or last two
791       buttons to QMessageBox::NoButton.
792
793       One button can be OR-ed with QMessageBox::Default, and one button can
794       be OR-ed with QMessageBox::Escape.
795
796       Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) of the
797       button that was clicked.
798
799       If parent is 0, the message box becomes an application-global modal
800       dialog box. If parent is a widget, the message box becomes modal
801       relative to parent.
802
803       See also information(), question(), and critical().
804
805       Examples:
806

int QMessageBox::warning ( QWidget * parent, const QString & caption, const

808       QString & text, const QString & button0Text = QString::null, const
809       QString & button1Text = QString::null, const QString & button2Text =
810       QString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1
811       ) [static]
812       This is an overloaded member function, provided for convenience. It
813       behaves essentially like the above function.
814
815       Displays a warning message box with a caption, a text, and 1, 2 or 3
816       buttons. Returns the number of the button that was clicked (0, 1, or
817       2).
818
819       button0Text is the text of the first button, and is optional. If
820       button0Text is not supplied, "OK" (translated) will be used.
821       button1Text is the text of the second button, and is optional, and
822       button2Text is the text of the third button, and is optional.
823       defaultButtonNumber (0, 1 or 2) is the index of the default button;
824       pressing Return or Enter is the same as clicking the default button. It
825       defaults to 0 (the first button). escapeButtonNumber is the index of
826       the Escape button; pressing Escape is the same as clicking this button.
827       It defaults to -1; supply 0, 1, or 2 to make pressing Escape equivalent
828       to clicking the relevant button.
829
830       If parent is 0, the message box becomes an application-global modal
831       dialog box. If parent is a widget, the message box becomes modal
832       relative to parent.
833
834       Note: If you do not specify an Escape button then if the Escape button
835       is pressed then -1 will be returned. It is suggested that you specify
836       an Escape button to prevent this from happening.
837
838       See also information(), question(), and critical().
839
840   Property Documentation

Icon icon

842       This property holds the message box's icon.
843
844       The icon of the message box can be one of the following predefined
845       icons:
846
847       QMessageBox::NoIcon
848
849       QMessageBox::Question
850
851       QMessageBox::Information
852
853       QMessageBox::Warning
854
855       QMessageBox::Critical
856
857       The actual pixmap used for displaying the icon depends on the current
858       GUI style. You can also set a custom pixmap icon using the
859       QMessageBox::iconPixmap property. The default icon is
860       QMessageBox::NoIcon.
861
862       See also iconPixmap.
863
864       Set this property's value with setIcon() and get this property's value
865       with icon().
866

QPixmap iconPixmap

868       This property holds the current icon.
869
870       The icon currently used by the message box. Note that it's often hard
871       to draw one pixmap that looks appropriate in both Motif and Windows GUI
872       styles; you may want to draw two pixmaps.
873
874       See also icon.
875
876       Set this property's value with setIconPixmap() and get this property's
877       value with iconPixmap().
878

QString text

880       This property holds the message box text to be displayed.
881
882       The text will be interpreted either as a plain text or as rich text,
883       depending on the text format setting (QMessageBox::textFormat). The
884       default setting is AutoText, i.e. the message box will try to auto-
885       detect the format of the text.
886
887       The default value of this property is QString::null.
888
889       See also textFormat.
890
891       Set this property's value with setText() and get this property's value
892       with text().
893

TextFormat textFormat

895       This property holds the format of the text displayed by the message
896       box.
897
898       The current text format used by the message box. See the Qt::TextFormat
899       enum for an explanation of the possible options.
900
901       The default format is AutoText.
902
903       See also text.
904
905       Set this property's value with setTextFormat() and get this property's
906       value with textFormat().
907
908

SEE ALSO

910       http://doc.trolltech.com/qmessagebox.html
911       http://www.trolltech.com/faq/tech.html
912
914       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
915       license file included in the distribution for a complete license
916       statement.
917

AUTHOR

919       Generated automatically from the source code.
920

BUGS

922       If you find a bug in Qt, please report it as described in
923       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
924       help you. Thank you.
925
926       The definitive Qt documentation is provided in HTML format; it is
927       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
928       web browser. This man page is provided as a convenience for those users
929       who prefer man pages, although this format is not officially supported
930       by Trolltech.
931
932       If you find errors in this manual page, please report them to qt-
933       bugs@trolltech.com.  Please include the name of the manual page
934       (qmessagebox.3qt) and the Qt version (3.3.8).
935
936
937
938Trolltech AS                    2 February 2007               QMessageBox(3qt)
Impressum