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 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QMessageBox Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" 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="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QMessageBox Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QMessageBox class provides a modal dialog for informing the
user or for asking the user a question and receiving an answer.
<a href="#details">More...</a></p>
<p>Inherits <a href="qdialog.html">QDialog</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a></b> { InvalidRole, AcceptRole, RejectRole, DestructiveRole, ..., ApplyRole }</li><li><div class="fn" />enum <b><a href="qmessagebox.html#Icon-enum">Icon</a></b> { NoIcon, Information, Warning, Critical, Question }</li><li><div class="fn" />enum <b><a href="qmessagebox.html#StandardButton-enum">StandardButton</a></b> { NoButton, Ok, Save, SaveAll, ..., ButtonMask }</li><li><div class="fn" />class <b><a href="qmessagebox-standardbuttons.html">StandardButtons</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qmessagebox.html#QMessageBox">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qmessagebox.html#QMessageBox-2">__init__</a></b> (<i>self</i>, Icon <i>icon</i>, QString <i>title</i>, QString <i>text</i>, StandardButtons <i>buttons</i> = QMessageBox.NoButton, QWidget <i>parent</i> = None, Qt.WindowFlags <i>flags</i> = Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)</li><li><div class="fn" /><b><a href="qmessagebox.html#QMessageBox-3">__init__</a></b> (<i>self</i>, QString <i>title</i>, QString <i>text</i>, Icon <i>icon</i>, int <i>button0</i>, int <i>button1</i>, int <i>button2</i>, QWidget <i>parent</i> = None, Qt.WindowFlags <i>flags</i> = Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)</li><li><div class="fn" /><b><a href="qmessagebox.html#addButton">addButton</a></b> (<i>self</i>, QAbstractButton <i>button</i>, ButtonRole <i>role</i>)</li><li><div class="fn" />QPushButton <b><a href="qmessagebox.html#addButton-2">addButton</a></b> (<i>self</i>, QString <i>text</i>, ButtonRole <i>role</i>)</li><li><div class="fn" />QPushButton <b><a href="qmessagebox.html#addButton-3">addButton</a></b> (<i>self</i>, StandardButton <i>button</i>)</li><li><div class="fn" />QAbstractButton <b><a href="qmessagebox.html#button">button</a></b> (<i>self</i>, StandardButton <i>which</i>)</li><li><div class="fn" />ButtonRole <b><a href="qmessagebox.html#buttonRole">buttonRole</a></b> (<i>self</i>, QAbstractButton <i>button</i>)</li><li><div class="fn" />unknown-type <b><a href="qmessagebox.html#buttons">buttons</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qmessagebox.html#buttonText">buttonText</a></b> (<i>self</i>, int <i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />QAbstractButton <b><a href="qmessagebox.html#clickedButton">clickedButton</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#closeEvent">closeEvent</a></b> (<i>self</i>, QCloseEvent)</li><li><div class="fn" />QPushButton <b><a href="qmessagebox.html#defaultButton">defaultButton</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qmessagebox.html#detailedText">detailedText</a></b> (<i>self</i>)</li><li><div class="fn" />QAbstractButton <b><a href="qmessagebox.html#escapeButton">escapeButton</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmessagebox.html#event">event</a></b> (<i>self</i>, QEvent <i>e</i>)</li><li><div class="fn" />Icon <b><a href="qmessagebox.html#icon">icon</a></b> (<i>self</i>)</li><li><div class="fn" />QPixmap <b><a href="qmessagebox.html#iconPixmap">iconPixmap</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qmessagebox.html#informativeText">informativeText</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent)</li><li><div class="fn" /><b><a href="qmessagebox.html#open">open</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#open-2">open</a></b> (<i>self</i>, QObject <i>receiver</i>, object <i>member</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#open-3">open</a></b> (<i>self</i>, object <i>slot</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#removeButton">removeButton</a></b> (<i>self</i>, QAbstractButton <i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qmessagebox.html#setButtonText">setButtonText</a></b> (<i>self</i>, int <i>button</i>, QString)</li><li><div class="fn" /><b><a href="qmessagebox.html#setDefaultButton">setDefaultButton</a></b> (<i>self</i>, QPushButton <i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setDefaultButton-2">setDefaultButton</a></b> (<i>self</i>, StandardButton <i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setDetailedText">setDetailedText</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setEscapeButton">setEscapeButton</a></b> (<i>self</i>, QAbstractButton <i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setEscapeButton-2">setEscapeButton</a></b> (<i>self</i>, StandardButton <i>button</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setIcon">setIcon</a></b> (<i>self</i>, Icon)</li><li><div class="fn" /><b><a href="qmessagebox.html#setIconPixmap">setIconPixmap</a></b> (<i>self</i>, QPixmap)</li><li><div class="fn" /><b><a href="qmessagebox.html#setInformativeText">setInformativeText</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setStandardButtons">setStandardButtons</a></b> (<i>self</i>, StandardButtons <i>buttons</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setText">setText</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qmessagebox.html#setTextFormat">setTextFormat</a></b> (<i>self</i>, Qt.TextFormat)</li><li><div class="fn" /><b><a href="qmessagebox.html#setWindowModality">setWindowModality</a></b> (<i>self</i>, Qt.WindowModality <i>windowModality</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#setWindowTitle">setWindowTitle</a></b> (<i>self</i>, QString <i>title</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#showEvent">showEvent</a></b> (<i>self</i>, QShowEvent)</li><li><div class="fn" />QSize <b><a href="qmessagebox.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#standardButton">standardButton</a></b> (<i>self</i>, QAbstractButton <i>button</i>)</li><li><div class="fn" />StandardButtons <b><a href="qmessagebox.html#standardButtons">standardButtons</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qmessagebox.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.TextFormat <b><a href="qmessagebox.html#textFormat">textFormat</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" /><b><a href="qmessagebox.html#about">about</a></b> (QWidget <i>parent</i>, QString <i>caption</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qmessagebox.html#aboutQt">aboutQt</a></b> (QWidget <i>parent</i>, QString <i>title</i> = '')</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#critical">critical</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, StandardButtons <i>buttons</i> = QMessageBox.Ok, StandardButton <i>defaultButton</i> = QMessageBox.NoButton)</li><li><div class="fn" />int <b><a href="qmessagebox.html#critical-2">critical</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, int <i>button0</i>, int <i>button1</i>, int <i>button2</i> = 0)</li><li><div class="fn" />int <b><a href="qmessagebox.html#critical-3">critical</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, QString <i>button0Text</i>, QString <i>button1Text</i> = '', QString <i>button2Text</i> = '', int <i>defaultButtonNumber</i> = 0, int <i>escapeButtonNumber</i> = -1)</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#information">information</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, StandardButtons <i>buttons</i> = QMessageBox.Ok, StandardButton <i>defaultButton</i> = QMessageBox.NoButton)</li><li><div class="fn" />int <b><a href="qmessagebox.html#information-2">information</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, int <i>button0</i>, int <i>button1</i> = 0, int <i>button2</i> = 0)</li><li><div class="fn" />int <b><a href="qmessagebox.html#information-3">information</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, QString <i>button0Text</i>, QString <i>button1Text</i> = '', QString <i>button2Text</i> = '', int <i>defaultButtonNumber</i> = 0, int <i>escapeButtonNumber</i> = -1)</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#question">question</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, StandardButtons <i>buttons</i> = QMessageBox.Ok, StandardButton <i>defaultButton</i> = QMessageBox.NoButton)</li><li><div class="fn" />int <b><a href="qmessagebox.html#question-2">question</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, int <i>button0</i>, int <i>button1</i> = 0, int <i>button2</i> = 0)</li><li><div class="fn" />int <b><a href="qmessagebox.html#question-3">question</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, QString <i>button0Text</i>, QString <i>button1Text</i> = '', QString <i>button2Text</i> = '', int <i>defaultButtonNumber</i> = 0, int <i>escapeButtonNumber</i> = -1)</li><li><div class="fn" />QPixmap <b><a href="qmessagebox.html#standardIcon">standardIcon</a></b> (Icon <i>icon</i>)</li><li><div class="fn" />StandardButton <b><a href="qmessagebox.html#warning">warning</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, StandardButtons <i>buttons</i> = QMessageBox.Ok, StandardButton <i>defaultButton</i> = QMessageBox.NoButton)</li><li><div class="fn" />int <b><a href="qmessagebox.html#warning-2">warning</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, int <i>button0</i>, int <i>button1</i>, int <i>button2</i> = 0)</li><li><div class="fn" />int <b><a href="qmessagebox.html#warning-3">warning</a></b> (QWidget <i>parent</i>, QString <i>title</i>, QString <i>text</i>, QString <i>button0Text</i>, QString <i>button1Text</i> = '', QString <i>button2Text</i> = '', int <i>defaultButtonNumber</i> = 0, int <i>escapeButtonNumber</i> = -1)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qmessagebox.html#buttonClicked">buttonClicked</a></b> ( ::QAbstractButton*)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QMessageBox class provides a modal dialog for informing the
user or for asking the user a question and receiving an answer.</p>
<p>A message box displays a primary <a href="qmessagebox.html#text-prop">text</a> to alert the user to a
situation, an <a href="qmessagebox.html#informativeText-prop">informative text</a> to
further explain the alert or to ask the user a question, and an
optional <a href="qmessagebox.html#detailedText-prop">detailed
text</a> to provide even more data if the user requests it. A
message box can also display an <a href="qmessagebox.html#icon-prop">icon</a> and <a href="qmessagebox.html#standardButtons-prop">standard buttons</a> for
accepting a user response.</p>
<p>Two APIs for using QMessageBox are provided, the property-based
API, and the static functions. Calling one of the static functions
is the simpler approach, but it is less flexible than using the
property-based API, and the result is less informative. Using the
property-based API is recommended.</p>
<a id="the-property-based-api" name="the-property-based-api" />
<h3>The Property-based API</h3>
<p>To use the property-based API, construct an instance of
QMessageBox, set the desired properties, and call <a href="qmessagebox.html#exec">exec_</a>() to show the message. The
simplest configuration is to set only the <a href="qmessagebox.html#text-prop">message text</a> property.</p>
<pre class="cpp">
<span class="type">QMessageBox</span> msgBox;
msgBox<span class="operator">.</span><a href="qmessagebox.html#text-prop">setText</a>(<span class="string">"The document has been modified."</span>);
msgBox<span class="operator">.</span><a href="qmessagebox.html#exec">exec_</a>();
</pre>
<p>The user must click the <b>OK</b> button to dismiss the message
box. The rest of the GUI is blocked until the message box is
dismissed.</p>
<p class="centerAlign"><img alt="" src="images/msgbox1.png" /></p>
<p>A better approach than just alerting the user to an event is to
also ask the user what to do about it. Store the question in the
<a href="qmessagebox.html#informativeText-prop">informative
text</a> property, and set the <a href="qmessagebox.html#standardButtons-prop">standard buttons</a>
property to the set of buttons you want as the set of user
responses. The buttons are specified by combining values from
<a href="qmessagebox.html#StandardButton-enum">StandardButtons</a>
using the bitwise OR operator. The display order for the buttons is
platform-dependent. For example, on Windows, <b>Save</b> is
displayed to the left of <b>Cancel</b>, whereas on Mac OS, the
order is reversed.</p>
<p>Mark one of your standard buttons to be your <a href="qmessagebox.html#defaultButton">default button</a>.</p>
<pre class="cpp">
<span class="type">QMessageBox</span> msgBox;
msgBox<span class="operator">.</span><a href="qmessagebox.html#text-prop">setText</a>(<span class="string">"The document has been modified."</span>);
msgBox<span class="operator">.</span><a href="qmessagebox.html#informativeText-prop">setInformativeText</a>(<span class="string">"Do you want to save your changes?"</span>);
msgBox<span class="operator">.</span><a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>(<span class="type">QMessageBox</span><span class="operator">.</span>Save <span class="operator">|</span> <span class="type">QMessageBox</span><span class="operator">.</span>Discard <span class="operator">|</span> <span class="type">QMessageBox</span><span class="operator">.</span>Cancel);
msgBox<span class="operator">.</span><a href="qmessagebox.html#setDefaultButton">setDefaultButton</a>(<span class="type">QMessageBox</span><span class="operator">.</span>Save);
<span class="type">int</span> ret <span class="operator">=</span> msgBox<span class="operator">.</span><a href="qmessagebox.html#exec">exec_</a>();
</pre>
<p>This is the approach recommended in the <a href="http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID">
Mac OS X Guidelines</a>. Similar guidelines apply for the other
platforms, but note the different ways the <a href="qmessagebox.html#informativeText-prop">informative text</a> is
handled for different platforms.</p>
<p class="centerAlign"><img alt="" src="images/msgbox2.png" /></p>
<p>The <a href="qmessagebox.html#exec">exec_</a>() slot returns the
<a href="qmessagebox.html#StandardButton-enum">StandardButtons</a>
value of the button that was clicked.</p>
<pre class="cpp">
<span class="keyword">switch</span> (ret) {
<span class="keyword">case</span> <span class="type">QMessageBox</span><span class="operator">.</span>Save:
<span class="comment">// Save was clicked</span>
<span class="keyword">break</span>;
<span class="keyword">case</span> <span class="type">QMessageBox</span><span class="operator">.</span>Discard:
<span class="comment">// Don't Save was clicked</span>
<span class="keyword">break</span>;
<span class="keyword">case</span> <span class="type">QMessageBox</span><span class="operator">.</span>Cancel:
<span class="comment">// Cancel was clicked</span>
<span class="keyword">break</span>;
<span class="keyword">default</span>:
<span class="comment">// should never be reached</span>
<span class="keyword">break</span>;
}
</pre>
<p>To give the user more information to help him answer the
question, set the <a href="qmessagebox.html#detailedText-prop">detailed text</a> property. If
the <a href="qmessagebox.html#detailedText-prop">detailed text</a>
property is set, the <b>Show Details...</b> button will be
shown.</p>
<p class="centerAlign"><img alt="" src="images/msgbox3.png" /></p>
<p>Clicking the <b>Show Details...</b> button displays the detailed
text.</p>
<p class="centerAlign"><img alt="" src="images/msgbox4.png" /></p>
<a id="rich-text-and-the-text-format-property" name="rich-text-and-the-text-format-property" />
<h4>Rich Text and the Text Format Property</h4>
<p>The <a href="qmessagebox.html#detailedText-prop">detailed
text</a> property is always interpreted as plain text. The <a href="qmessagebox.html#text-prop">main text</a> and <a href="qmessagebox.html#informativeText-prop">informative text</a>
properties can be either plain text or rich text. These strings are
interpreted according to the setting of the <a href="qmessagebox.html#textFormat-prop">text format</a> property. The
default setting is <a href="qt.html#TextFormat-enum">auto-text</a>.</p>
<p>Note that for some plain text strings containing XML
meta-characters, the auto-text <a href="qt.html#mightBeRichText">rich text detection test</a> may fail
causing your plain text string to be interpreted incorrectly as
rich text. In these rare cases, use <a href="qt.html#convertFromPlainText">Qt.convertFromPlainText</a>() to
convert your plain text string to a visually equivalent rich text
string, or set the <a href="qmessagebox.html#textFormat-prop">text
format</a> property explicitly with <a href="qmessagebox.html#textFormat-prop">setTextFormat</a>().</p>
<a id="severity-levels-and-the-icon-and-pixmap-properties" name="severity-levels-and-the-icon-and-pixmap-properties" />
<h4>Severity Levels and the Icon and Pixmap Properties</h4>
<p>QMessageBox supports four predefined message severity levels, or
message types, which really only differ in the predefined icon they
each show. Specify one of the four predefined message types by
setting the <a href="qmessagebox.html#icon-prop">icon</a> property
to one of the <a href="qmessagebox.html#Icon-enum">predefined
icons</a>. The following rules are guidelines:</p>
<table class="generic">
<tr class="odd" valign="top">
<td>
<p class="centerAlign"><img alt="" src="images/qmessagebox-quest.png" /></p>
</td>
<td><a href="qmessagebox.html#Icon-enum">Question</a></td>
<td>For asking a question during normal operations.</td>
</tr>
<tr class="even" valign="top">
<td>
<p class="centerAlign"><img alt="" src="images/qmessagebox-info.png" /></p>
</td>
<td><a href="qmessagebox.html#Icon-enum">Information</a></td>
<td>For reporting information about normal operations.</td>
</tr>
<tr class="odd" valign="top">
<td>
<p class="centerAlign"><img alt="" src="images/qmessagebox-warn.png" /></p>
</td>
<td><a href="qmessagebox.html#Icon-enum">Warning</a></td>
<td>For reporting non-critical errors.</td>
</tr>
<tr class="even" valign="top">
<td>
<p class="centerAlign"><img alt="" src="images/qmessagebox-crit.png" /></p>
</td>
<td><a href="qmessagebox.html#Icon-enum">Critical</a></td>
<td>For reporting critical errors.</td>
</tr>
</table>
<p><a href="qmessagebox.html#Icon-enum">Predefined icons</a> are
not defined by QMessageBox, but provided by the style. The default
value is <a href="qmessagebox.html#Icon-enum">No Icon</a>. The
message boxes are otherwise the same for all cases. When using a
standard icon, use the one recommended in the table, or use the one
recommended by the style guidelines for your platform. If none of
the standard icons is right for your message box, you can use a
custom icon by setting the <a href="qmessagebox.html#iconPixmap-prop">icon pixmap</a> property instead
of setting the <a href="qmessagebox.html#icon-prop">icon</a>
property.</p>
<p>In summary, to set an icon, use <i>either</i> <a href="qmessagebox.html#icon-prop">setIcon</a>() for one of the standard
icons, <i>or</i> <a href="qmessagebox.html#iconPixmap-prop">setIconPixmap</a>() for a custom
icon.</p>
<a id="the-static-functions-api" name="the-static-functions-api" />
<h3>The Static Functions API</h3>
<p>Building message boxes with the static functions API, although
convenient, is less flexible than using the property-based API,
because the static function signatures lack parameters for setting
the <a href="qmessagebox.html#informativeText-prop">informative
text</a> and <a href="qmessagebox.html#detailedText-prop">detailed
text</a> properties. One work-around for this has been to use the
<tt>title</tt> parameter as the message box main text and the
<tt>text</tt> parameter as the message box informative text.
Because this has the obvious drawback of making a less readable
message box, platform guidelines do not recommend it. The
<i>Microsoft Windows User Interface Guidelines</i> recommend using
the <a href="qcoreapplication.html#applicationName-prop">application name</a>
as the <a href="qmessagebox.html#setWindowTitle">window's
title</a>, which means that if you have an informative text in
addition to your main text, you must concatenate it to the
<tt>text</tt> parameter.</p>
<p>Note that the static function signatures have changed with
respect to their button parameters, which are now used to set the
<a href="qmessagebox.html#standardButtons-prop">standard
buttons</a> and the <a href="qmessagebox.html#defaultButton">default button</a>.</p>
<p>Static functions are available for creating <a href="qmessagebox.html#information">information</a>(), <a href="qmessagebox.html#question">question</a>(), <a href="qmessagebox.html#warning">warning</a>(), and <a href="qmessagebox.html#critical">critical</a>() message boxes.</p>
<pre class="cpp">
<span class="type">int</span> ret <span class="operator">=</span> <span class="type">QMessageBox</span><span class="operator">.</span><a href="qmessagebox.html#warning">warning</a>(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"My Application"</span>)<span class="operator">,</span>
tr(<span class="string">"The document has been modified.\n"</span>
<span class="string">"Do you want to save your changes?"</span>)<span class="operator">,</span>
<span class="type">QMessageBox</span><span class="operator">.</span>Save <span class="operator">|</span> <span class="type">QMessageBox</span><span class="operator">.</span>Discard
<span class="operator">|</span> <span class="type">QMessageBox</span><span class="operator">.</span>Cancel<span class="operator">,</span>
<span class="type">QMessageBox</span><span class="operator">.</span>Save);
</pre>
<p>The <a href="dialogs-standarddialogs.html">Standard Dialogs</a>
example shows how to use QMessageBox and the other built-in Qt
dialogs.</p>
<a id="advanced-usage" name="advanced-usage" />
<h3>Advanced Usage</h3>
<p>If the <a href="qmessagebox.html#StandardButton-enum">standard
buttons</a> are not flexible enough for your message box, you can
use the <a href="qmessagebox.html#addButton">addButton</a>()
overload that takes a text and a ButtonRoleto to add custom
buttons. The <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> is used by
QMessageBox to determine the ordering of the buttons on screen
(which varies according to the platform). You can test the value of
<a href="qmessagebox.html#clickedButton">clickedButton</a>() after
calling <a href="qmessagebox.html#exec">exec_</a>(). For
example,</p>
<pre class="cpp">
<span class="type">QMessageBox</span> msgBox;
<span class="type"><a href="qpushbutton.html">QPushButton</a></span> <span class="operator">*</span>connectButton <span class="operator">=</span> msgBox<span class="operator">.</span><a href="qmessagebox.html#addButton">addButton</a>(tr(<span class="string">"Connect"</span>)<span class="operator">,</span> <span class="type">QMessageBox</span><span class="operator">.</span>ActionRole);
<span class="type"><a href="qpushbutton.html">QPushButton</a></span> <span class="operator">*</span>abortButton <span class="operator">=</span> msgBox<span class="operator">.</span><a href="qmessagebox.html#addButton">addButton</a>(<span class="type">QMessageBox</span><span class="operator">.</span>Abort);
msgBox<span class="operator">.</span><a href="qmessagebox.html#exec">exec_</a>();
<span class="keyword">if</span> (msgBox<span class="operator">.</span>clickedButton() <span class="operator">=</span><span class="operator">=</span> connectButton) {
<span class="comment">// connect</span>
} <span class="keyword">else</span> <span class="keyword">if</span> (msgBox<span class="operator">.</span>clickedButton() <span class="operator">=</span><span class="operator">=</span> abortButton) {
<span class="comment">// abort</span>
}
</pre>
<a id="default-and-escape-keys" name="default-and-escape-keys" />
<h3>Default and Escape Keys</h3>
<p>The default button (i.e., the button activated when <b>Enter</b>
is pressed) can be specified using <a href="qmessagebox.html#setDefaultButton">setDefaultButton</a>(). If a
default button is not specified, QMessageBox tries to find one
based on the <a href="qmessagebox.html#ButtonRole-enum">button
roles</a> of the buttons used in the message box.</p>
<p>The escape button (the button activated when <b>Esc</b> is
pressed) can be specified using <a href="qmessagebox.html#setEscapeButton">setEscapeButton</a>(). If an
escape button is not specified, QMessageBox tries to find one using
these rules:</p>
<ol class="1">
<li>If there is only one button, it is the button activated when
<b>Esc</b> is pressed.</li>
<li>If there is a <a href="qmessagebox.html#StandardButton-enum">Cancel</a> button, it is the
button activated when <b>Esc</b> is pressed.</li>
<li>If there is exactly one button having either <a href="qmessagebox.html#ButtonRole-enum">the Reject role</a> or the
<a href="qmessagebox.html#ButtonRole-enum">the No role</a>, it is
the button activated when <b>Esc</b> is pressed.</li>
</ol>
<p>When an escape button can't be determined using these rules,
pressing <b>Esc</b> has no effect.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ButtonRole-enum" />QMessageBox.ButtonRole</h3><p>This enum describes the roles that can be used to describe
buttons in the button box. Combinations of these roles are as flags
used to describe different aspects of their behavior.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.InvalidRole</tt></td>
<td class="topAlign"><tt>-1</tt></td>
<td class="topAlign">The button is invalid.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.AcceptRole</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Clicking the button causes the dialog to be
accepted (e.g. OK).</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.RejectRole</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Clicking the button causes the dialog to be
rejected (e.g. Cancel).</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.DestructiveRole</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">Clicking the button causes a destructive
change (e.g. for Discarding Changes) and closes the dialog.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.ActionRole</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">Clicking the button causes changes to the
elements within the dialog.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.HelpRole</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">The button can be clicked to request
help.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.YesRole</tt></td>
<td class="topAlign"><tt>5</tt></td>
<td class="topAlign">The button is a "Yes"-like button.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoRole</tt></td>
<td class="topAlign"><tt>6</tt></td>
<td class="topAlign">The button is a "No"-like button.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.ApplyRole</tt></td>
<td class="topAlign"><tt>8</tt></td>
<td class="topAlign">The button applies current changes.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.ResetRole</tt></td>
<td class="topAlign"><tt>7</tt></td>
<td class="topAlign">The button resets the dialog's fields to
default values.</td>
</tr>
</table>
<p><b>See also</b> <a href="qmessagebox.html#StandardButton-enum">StandardButton</a>.</p>
<h3 class="fn"><a name="Icon-enum" />QMessageBox.Icon</h3><p>This enum has the following values:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoIcon</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">the message box does not have any icon.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Question</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">an icon indicating that the message is asking
a question.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Information</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">an icon indicating that the message is nothing
out of the ordinary.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Warning</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">an icon indicating that the message is a
warning, but can be dealt with.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Critical</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">an icon indicating that the message represents
a critical problem.</td>
</tr>
</table>
<h3 class="fn"><a name="StandardButton-enum" />QMessageBox.StandardButton</h3><p>These enums describe flags for standard buttons. Each button has
a defined <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a>.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Ok</tt></td>
<td class="topAlign"><tt>0x00000400</tt></td>
<td class="topAlign">An "OK" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Open</tt></td>
<td class="topAlign"><tt>0x00002000</tt></td>
<td class="topAlign">A "Open" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Save</tt></td>
<td class="topAlign"><tt>0x00000800</tt></td>
<td class="topAlign">A "Save" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Cancel</tt></td>
<td class="topAlign"><tt>0x00400000</tt></td>
<td class="topAlign">A "Cancel" button defined with the <a href="qmessagebox.html#ButtonRole-enum">RejectRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Close</tt></td>
<td class="topAlign"><tt>0x00200000</tt></td>
<td class="topAlign">A "Close" button defined with the <a href="qmessagebox.html#ButtonRole-enum">RejectRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Discard</tt></td>
<td class="topAlign"><tt>0x00800000</tt></td>
<td class="topAlign">A "Discard" or "Don't Save" button, depending
on the platform, defined with the <a href="qmessagebox.html#ButtonRole-enum">DestructiveRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Apply</tt></td>
<td class="topAlign"><tt>0x02000000</tt></td>
<td class="topAlign">An "Apply" button defined with the <a href="qmessagebox.html#ButtonRole-enum">ApplyRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Reset</tt></td>
<td class="topAlign"><tt>0x04000000</tt></td>
<td class="topAlign">A "Reset" button defined with the <a href="qmessagebox.html#ButtonRole-enum">ResetRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.RestoreDefaults</tt></td>
<td class="topAlign"><tt>0x08000000</tt></td>
<td class="topAlign">A "Restore Defaults" button defined with the
<a href="qmessagebox.html#ButtonRole-enum">ResetRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Help</tt></td>
<td class="topAlign"><tt>0x01000000</tt></td>
<td class="topAlign">A "Help" button defined with the <a href="qmessagebox.html#ButtonRole-enum">HelpRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.SaveAll</tt></td>
<td class="topAlign"><tt>0x00001000</tt></td>
<td class="topAlign">A "Save All" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Yes</tt></td>
<td class="topAlign"><tt>0x00004000</tt></td>
<td class="topAlign">A "Yes" button defined with the <a href="qmessagebox.html#ButtonRole-enum">YesRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.YesToAll</tt></td>
<td class="topAlign"><tt>0x00008000</tt></td>
<td class="topAlign">A "Yes to All" button defined with the
<a href="qmessagebox.html#ButtonRole-enum">YesRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.No</tt></td>
<td class="topAlign"><tt>0x00010000</tt></td>
<td class="topAlign">A "No" button defined with the <a href="qmessagebox.html#ButtonRole-enum">NoRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoToAll</tt></td>
<td class="topAlign"><tt>0x00020000</tt></td>
<td class="topAlign">A "No to All" button defined with the <a href="qmessagebox.html#ButtonRole-enum">NoRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Abort</tt></td>
<td class="topAlign"><tt>0x00040000</tt></td>
<td class="topAlign">An "Abort" button defined with the <a href="qmessagebox.html#ButtonRole-enum">RejectRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Retry</tt></td>
<td class="topAlign"><tt>0x00080000</tt></td>
<td class="topAlign">A "Retry" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Ignore</tt></td>
<td class="topAlign"><tt>0x00100000</tt></td>
<td class="topAlign">An "Ignore" button defined with the <a href="qmessagebox.html#ButtonRole-enum">AcceptRole</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoButton</tt></td>
<td class="topAlign"><tt>0x00000000</tt></td>
<td class="topAlign">An invalid button.</td>
</tr>
</table>
<p>The following values are obsolete:</p>
<table class="valuelist">
<tr class="even" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.YesAll</tt></td>
<td class="topAlign"><tt>YesToAll</tt></td>
<td class="topAlign">Use YesToAll instead.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.NoAll</tt></td>
<td class="topAlign"><tt>NoToAll</tt></td>
<td class="topAlign">Use NoToAll instead.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Default</tt></td>
<td class="topAlign"><tt>0x00000100</tt></td>
<td class="topAlign">Use the <tt>defaultButton</tt> argument of
<a href="qmessagebox.html#information">information</a>(), <a href="qmessagebox.html#warning">warning</a>(), etc. instead, or call
<a href="qmessagebox.html#setDefaultButton">setDefaultButton</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.Escape</tt></td>
<td class="topAlign"><tt>0x00000200</tt></td>
<td class="topAlign">Call <a href="qmessagebox.html#setEscapeButton">setEscapeButton</a>()
instead.</td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.FlagMask</tt></td>
<td class="topAlign"><tt>0x00000300</tt></td>
<td class="topAlign"> </td>
</tr>
<tr>
<td class="topAlign"><tt>QMessageBox.ButtonMask</tt></td>
<td class="topAlign"><tt>~FlagMask</tt></td>
<td class="topAlign"> </td>
</tr>
</table>
<p>This enum was introduced or modified in Qt 4.2.</p>
<p>The StandardButtons type is a typedef for <a href="qflags.html">QFlags</a><StandardButton>. It stores an OR
combination of StandardButton values.</p>
<p><b>See also</b> <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> and <a href="qmessagebox.html#standardButtons-prop">standardButtons</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QMessageBox" />QMessageBox.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a message box with no text and no buttons.
<i>parent</i> is passed to the <a href="qdialog.html">QDialog</a>
constructor.</p>
<p>On Mac OS X, if you want your message box to appear as a
<a href="qt.html#WindowType-enum">Qt.Sheet</a> of its
<i>parent</i>, set the message box's <a href="qmessagebox.html#setWindowModality">window modality</a> to
<a href="qt.html#WindowModality-enum">Qt.WindowModal</a> or use
<a href="qmessagebox.html#open">open</a>(). Otherwise, the message
box will be a standard dialog.</p>
<h3 class="fn"><a name="QMessageBox-2" />QMessageBox.__init__ (<i>self</i>, <a href="qmessagebox.html#Icon-enum">Icon</a> <i>icon</i>, QString <i>title</i>, QString <i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a> <i>buttons</i> = QMessageBox.NoButton, <a href="qwidget.html">QWidget</a> <i>parent</i> = None, <a href="qt-windowflags.html">Qt.WindowFlags</a> <i>flags</i> = Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a message box with the given <i>icon</i>,
<i>title</i>, <i>text</i>, and standard <i>buttons</i>. Standard or
custom buttons can be added at any time using <a href="qmessagebox.html#addButton">addButton</a>(). The <i>parent</i> and
<i>f</i> arguments are passed to the <a href="qdialog.html">QDialog</a> constructor.</p>
<p>The message box is an <a href="qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p>On Mac OS X, if <i>parent</i> is not 0 and you want your message
box to appear as a <a href="qt.html#WindowType-enum">Qt.Sheet</a>
of that parent, set the message box's <a href="qmessagebox.html#setWindowModality">window modality</a> to
<a href="qt.html#WindowModality-enum">Qt.WindowModal</a>
(default). Otherwise, the message box will be a standard
dialog.</p>
<p><b>See also</b> <a href="qmessagebox.html#setWindowTitle">setWindowTitle</a>(), <a href="qmessagebox.html#text-prop">setText</a>(), <a href="qmessagebox.html#icon-prop">setIcon</a>(), and <a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>().</p>
<h3 class="fn"><a name="QMessageBox-3" />QMessageBox.__init__ (<i>self</i>, QString <i>title</i>, QString <i>text</i>, <a href="qmessagebox.html#Icon-enum">Icon</a> <i>icon</i>, int <i>button0</i>, int <i>button1</i>, int <i>button2</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None, <a href="qt-windowflags.html">Qt.WindowFlags</a> <i>flags</i> = Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><h3 class="fn"><a name="about" />QMessageBox.about (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>caption</i>, QString <i>text</i>)</h3><p>Displays a simple about box with title <i>title</i> and text
<i>text</i>. The about box's parent is <i>parent</i>.</p>
<p>about() looks for a suitable icon in four locations:</p>
<ol class="1">
<li>It prefers <a href="qwidget.html#windowIcon-prop">parent->icon()</a> if that
exists.</li>
<li>If not, it tries the top-level widget containing
<i>parent</i>.</li>
<li>If that fails, it tries the <a href="qapplication.html#activeWindow">active window.</a></li>
<li>As a last resort it uses the Information icon.</li>
</ol>
<p>The about box has a single button labelled "OK". On Mac OS X,
the about box is popped up as a modeless window; on other
platforms, it is currently application modal.</p>
<p><b>See also</b> <a href="qwidget.html#windowIcon-prop">QWidget.windowIcon</a>() and
<a href="qapplication.html#activeWindow">QApplication.activeWindow</a>().</p>
<h3 class="fn"><a name="aboutQt" />QMessageBox.aboutQt (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i> = '')</h3><p>Displays a simple message box about Qt, with the given
<i>title</i> and centered over <i>parent</i> (if <i>parent</i> is
not 0). The message includes the version number of Qt being used by
the application.</p>
<p>This is useful for inclusion in the <b>Help</b> menu of an
application, as shown in the <a href="mainwindows-menus.html">Menus</a> example.</p>
<p><a href="qapplication.html">QApplication</a> provides this
functionality as a slot.</p>
<p>On Mac OS X, the about box is popped up as a modeless window; on
other platforms, it is currently application modal.</p>
<p><b>See also</b> <a href="qapplication.html#aboutQt">QApplication.aboutQt</a>().</p>
<h3 class="fn"><a name="addButton" />QMessageBox.addButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a> <i>button</i>, <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> <i>role</i>)</h3><p>The <i>button</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>button</i> to the message box with the
specified <i>role</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#removeButton">removeButton</a>(), <a href="qmessagebox.html#button">button</a>(), and <a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>().</p>
<h3 class="fn"><a name="addButton-2" /><a href="qpushbutton.html">QPushButton</a> QMessageBox.addButton (<i>self</i>, QString <i>text</i>, <a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> <i>role</i>)</h3><p>This is an overloaded function.</p>
<p>Creates a button with the given <i>text</i>, adds it to the
message box for the specified <i>role</i>, and returns it.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="addButton-3" /><a href="qpushbutton.html">QPushButton</a> QMessageBox.addButton (<i>self</i>, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> <i>button</i>)</h3><p>This is an overloaded function.</p>
<p>Adds a standard <i>button</i> to the message box if it is valid
to do so, and returns the push button.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>().</p>
<h3 class="fn"><a name="button" /><a href="qabstractbutton.html">QAbstractButton</a> QMessageBox.button (<i>self</i>, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> <i>which</i>)</h3><p>Returns a pointer corresponding to the standard button
<i>which</i>, or 0 if the standard button doesn't exist in this
message box.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#standardButtons-prop">standardButtons</a> and
<a href="qmessagebox.html#standardButton">standardButton</a>().</p>
<h3 class="fn"><a name="buttonRole" /><a href="qmessagebox.html#ButtonRole-enum">ButtonRole</a> QMessageBox.buttonRole (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a> <i>button</i>)</h3><p>Returns the button role for the specified <i>button</i>. This
function returns <a href="qmessagebox.html#ButtonRole-enum">InvalidRole</a> if <i>button</i>
is 0 or has not been added to the message box.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qmessagebox.html#buttons">buttons</a>()
and <a href="qmessagebox.html#addButton">addButton</a>().</p>
<h3 class="fn"><a name="buttons" />unknown-type QMessageBox.buttons (<i>self</i>)</h3><p>Returns a list of all the buttons that have been added to the
message box.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qmessagebox.html#buttonRole">buttonRole</a>(), <a href="qmessagebox.html#addButton">addButton</a>(), and <a href="qmessagebox.html#removeButton">removeButton</a>().</p>
<h3 class="fn"><a name="buttonText" />QString QMessageBox.buttonText (<i>self</i>, int <i>button</i>)</h3><h3 class="fn"><a name="changeEvent" />QMessageBox.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>
<h3 class="fn"><a name="clickedButton" /><a href="qabstractbutton.html">QAbstractButton</a> QMessageBox.clickedButton (<i>self</i>)</h3><p>Returns the button that was clicked by the user, or 0 if the
user hit the <b>Esc</b> key and no <a href="qmessagebox.html#setEscapeButton">escape button</a> was set.</p>
<p>If <a href="qmessagebox.html#exec">exec_</a>() hasn't been called
yet, returns 0.</p>
<p>Example:</p>
<pre class="cpp">
<span class="type"><a href="qmessagebox.html">QMessageBox</a></span> messageBox(<span class="keyword">this</span>);
<span class="type"><a href="qabstractbutton.html">QAbstractButton</a></span> <span class="operator">*</span>disconnectButton <span class="operator">=</span>
messageBox<span class="operator">.</span><a href="qmessagebox.html#addButton">addButton</a>(tr(<span class="string">"Disconnect"</span>)<span class="operator">,</span> <span class="type"><a href="qmessagebox.html">QMessageBox</a></span><span class="operator">.</span>ActionRole);
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
messageBox<span class="operator">.</span><a href="qmessagebox.html#exec">exec_</a>();
<span class="keyword">if</span> (messageBox<span class="operator">.</span>clickedButton() <span class="operator">=</span><span class="operator">=</span> disconnectButton) {
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
}
</pre>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#standardButton">standardButton</a>() and <a href="qmessagebox.html#button">button</a>().</p>
<h3 class="fn"><a name="closeEvent" />QMessageBox.closeEvent (<i>self</i>, <a href="qcloseevent.html">QCloseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#closeEvent">QWidget.closeEvent</a>().</p>
<h3 class="fn"><a name="critical" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.critical (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a> <i>buttons</i> = QMessageBox.Ok, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> <i>defaultButton</i> = QMessageBox.NoButton)</h3><p>Opens a critical message box with the given <i>title</i> and
<i>text</i> in front of the specified <i>parent</i> widget.</p>
<p>The standard <i>buttons</i> are added to the message box.
<i>defaultButton</i> specifies the button used when <b>Enter</b> is
pressed. <i>defaultButton</i> must refer to a button that was given
in <i>buttons</i>. If <i>defaultButton</i> is <a href="qmessagebox.html#StandardButton-enum">QMessageBox.NoButton</a>,
<a href="qmessagebox.html">QMessageBox</a> chooses a suitable
default automatically.</p>
<p>Returns the identity of the standard button that was clicked. If
<b>Esc</b> was pressed instead, the <a href="qmessagebox.html#default-and-escape-keys">escape button</a> is
returned.</p>
<p>The message box is an <a href="qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
of the dialog. If you want to do this, you should create the dialog
yourself using one of the <a href="qmessagebox.html">QMessageBox</a> constructors.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#question">question</a>(), <a href="qmessagebox.html#warning">warning</a>(), and <a href="qmessagebox.html#information">information</a>().</p>
<h3 class="fn"><a name="critical-2" />int QMessageBox.critical (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, int <i>button0</i>, int <i>button1</i>, int <i>button2</i> = 0)</h3><h3 class="fn"><a name="critical-3" />int QMessageBox.critical (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, QString <i>button0Text</i>, QString <i>button1Text</i> = '', QString <i>button2Text</i> = '', int <i>defaultButtonNumber</i> = 0, int <i>escapeButtonNumber</i> = -1)</h3><h3 class="fn"><a name="defaultButton" /><a href="qpushbutton.html">QPushButton</a> QMessageBox.defaultButton (<i>self</i>)</h3><p>Returns the button that should be the message box's <a href="qpushbutton.html#default-prop">default button</a>. Returns 0 if no
default button was set.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#setDefaultButton">setDefaultButton</a>(),
<a href="qmessagebox.html#addButton">addButton</a>(), and <a href="qpushbutton.html#default-prop">QPushButton.setDefault</a>().</p>
<h3 class="fn"><a name="detailedText" />QString QMessageBox.detailedText (<i>self</i>)</h3><h3 class="fn"><a name="escapeButton" /><a href="qabstractbutton.html">QAbstractButton</a> QMessageBox.escapeButton (<i>self</i>)</h3><p>Returns the button that is activated when escape is pressed.</p>
<p>By default, <a href="qmessagebox.html">QMessageBox</a> attempts
to automatically detect an escape button as follows:</p>
<ol class="1">
<li>If there is only one button, it is made the escape button.</li>
<li>If there is a <a href="qmessagebox.html#StandardButton-enum">Cancel</a> button, it is
made the escape button.</li>
<li>On Mac OS X only, if there is exactly one button with the role
<a href="qmessagebox.html#ButtonRole-enum">QMessageBox.RejectRole</a>, it
is made the escape button.</li>
</ol>
<p>When an escape button could not be automatically detected,
pressing <b>Esc</b> has no effect.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#setEscapeButton">setEscapeButton</a>() and
<a href="qmessagebox.html#addButton">addButton</a>().</p>
<h3 class="fn"><a name="event" />bool QMessageBox.event (<i>self</i>, <a href="qevent.html">QEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>
<h3 class="fn"><a name="icon" /><a href="qmessagebox.html#Icon-enum">Icon</a> QMessageBox.icon (<i>self</i>)</h3><h3 class="fn"><a name="iconPixmap" /><a href="qpixmap.html">QPixmap</a> QMessageBox.iconPixmap (<i>self</i>)</h3><h3 class="fn"><a name="information" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.information (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a> <i>buttons</i> = QMessageBox.Ok, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> <i>defaultButton</i> = QMessageBox.NoButton)</h3><p>Opens an information message box with the given <i>title</i> and
<i>text</i> in front of the specified <i>parent</i> widget.</p>
<p>The standard <i>buttons</i> are added to the message box.
<i>defaultButton</i> specifies the button used when <b>Enter</b> is
pressed. <i>defaultButton</i> must refer to a button that was given
in <i>buttons</i>. If <i>defaultButton</i> is <a href="qmessagebox.html#StandardButton-enum">QMessageBox.NoButton</a>,
<a href="qmessagebox.html">QMessageBox</a> chooses a suitable
default automatically.</p>
<p>Returns the identity of the standard button that was clicked. If
<b>Esc</b> was pressed instead, the <a href="qmessagebox.html#default-and-escape-keys">escape button</a> is
returned.</p>
<p>The message box is an <a href="qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
of the dialog. If you want to do this, you should create the dialog
yourself using one of the <a href="qmessagebox.html">QMessageBox</a> constructors.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#question">question</a>(), <a href="qmessagebox.html#warning">warning</a>(), and <a href="qmessagebox.html#critical">critical</a>().</p>
<h3 class="fn"><a name="information-2" />int QMessageBox.information (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, int <i>button0</i>, int <i>button1</i> = 0, int <i>button2</i> = 0)</h3><h3 class="fn"><a name="information-3" />int QMessageBox.information (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, QString <i>button0Text</i>, QString <i>button1Text</i> = '', QString <i>button2Text</i> = '', int <i>defaultButtonNumber</i> = 0, int <i>escapeButtonNumber</i> = -1)</h3><h3 class="fn"><a name="informativeText" />QString QMessageBox.informativeText (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QMessageBox.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p>
<h3 class="fn"><a name="open" />QMessageBox.open (<i>self</i>)</h3><p>This is an overloaded function.</p>
<p>Opens the dialog and connects its <a href="qdialog.html#finished">finished</a>() or <a href="qmessagebox.html#buttonClicked">buttonClicked</a>() signal to the
slot specified by <i>receiver</i> and <i>member</i>. If the slot in
<i>member</i> has a pointer for its first parameter the connection
is to <a href="qmessagebox.html#buttonClicked">buttonClicked</a>(),
otherwise the connection is to <a href="qdialog.html#finished">finished</a>().</p>
<p>The signal will be disconnected from the slot when the dialog is
closed.</p>
<h3 class="fn"><a name="open-2" />QMessageBox.open (<i>self</i>, <a href="qobject.html">QObject</a> <i>receiver</i>, object <i>member</i>)</h3><h3 class="fn"><a name="open-3" />QMessageBox.open (<i>self</i>, object <i>slot</i>)</h3><h3 class="fn"><a name="question" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.question (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a> <i>buttons</i> = QMessageBox.Ok, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> <i>defaultButton</i> = QMessageBox.NoButton)</h3><p>Opens a question message box with the given <i>title</i> and
<i>text</i> in front of the specified <i>parent</i> widget.</p>
<p>The standard <i>buttons</i> are added to the message box.
<i>defaultButton</i> specifies the button used when <b>Enter</b> is
pressed. <i>defaultButton</i> must refer to a button that was given
in <i>buttons</i>. If <i>defaultButton</i> is <a href="qmessagebox.html#StandardButton-enum">QMessageBox.NoButton</a>,
<a href="qmessagebox.html">QMessageBox</a> chooses a suitable
default automatically.</p>
<p>Returns the identity of the standard button that was clicked. If
<b>Esc</b> was pressed instead, the <a href="qmessagebox.html#default-and-escape-keys">escape button</a> is
returned.</p>
<p>The message box is an <a href="qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
of the dialog. If you want to do this, you should create the dialog
yourself using one of the <a href="qmessagebox.html">QMessageBox</a> constructors.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#information">information</a>(), <a href="qmessagebox.html#warning">warning</a>(), and <a href="qmessagebox.html#critical">critical</a>().</p>
<h3 class="fn"><a name="question-2" />int QMessageBox.question (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, int <i>button0</i>, int <i>button1</i> = 0, int <i>button2</i> = 0)</h3><h3 class="fn"><a name="question-3" />int QMessageBox.question (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, QString <i>button0Text</i>, QString <i>button1Text</i> = '', QString <i>button2Text</i> = '', int <i>defaultButtonNumber</i> = 0, int <i>escapeButtonNumber</i> = -1)</h3><h3 class="fn"><a name="removeButton" />QMessageBox.removeButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a> <i>button</i>)</h3><p>The <i>button</i> argument</p><p>Removes <i>button</i> from the button box without deleting
it.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#addButton">addButton</a>() and <a href="qmessagebox.html#standardButtons-prop">setStandardButtons</a>().</p>
<h3 class="fn"><a name="resizeEvent" />QMessageBox.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>
<h3 class="fn"><a name="setButtonText" />QMessageBox.setButtonText (<i>self</i>, int <i>button</i>, QString)</h3><h3 class="fn"><a name="setDefaultButton" />QMessageBox.setDefaultButton (<i>self</i>, <a href="qpushbutton.html">QPushButton</a> <i>button</i>)</h3><p>Sets the message box's <a href="qpushbutton.html#default-prop">default button</a> to
<i>button</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#defaultButton">defaultButton</a>(), <a href="qmessagebox.html#addButton">addButton</a>(), and <a href="qpushbutton.html#default-prop">QPushButton.setDefault</a>().</p>
<h3 class="fn"><a name="setDefaultButton-2" />QMessageBox.setDefaultButton (<i>self</i>, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> <i>button</i>)</h3><p>Sets the message box's <a href="qpushbutton.html#default-prop">default button</a> to
<i>button</i>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qmessagebox.html#addButton">addButton</a>() and <a href="qpushbutton.html#default-prop">QPushButton.setDefault</a>().</p>
<h3 class="fn"><a name="setDetailedText" />QMessageBox.setDetailedText (<i>self</i>, QString <i>text</i>)</h3><h3 class="fn"><a name="setEscapeButton" />QMessageBox.setEscapeButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a> <i>button</i>)</h3><p>Sets the button that gets activated when the <b>Escape</b> key
is pressed to <i>button</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#escapeButton">escapeButton</a>(), <a href="qmessagebox.html#addButton">addButton</a>(), and <a href="qmessagebox.html#clickedButton">clickedButton</a>().</p>
<h3 class="fn"><a name="setEscapeButton-2" />QMessageBox.setEscapeButton (<i>self</i>, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> <i>button</i>)</h3><p>Sets the buttons that gets activated when the <b>Escape</b> key
is pressed to <i>button</i>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qmessagebox.html#addButton">addButton</a>() and <a href="qmessagebox.html#clickedButton">clickedButton</a>().</p>
<h3 class="fn"><a name="setIcon" />QMessageBox.setIcon (<i>self</i>, <a href="qmessagebox.html#Icon-enum">Icon</a>)</h3><h3 class="fn"><a name="setIconPixmap" />QMessageBox.setIconPixmap (<i>self</i>, <a href="qpixmap.html">QPixmap</a>)</h3><h3 class="fn"><a name="setInformativeText" />QMessageBox.setInformativeText (<i>self</i>, QString <i>text</i>)</h3><h3 class="fn"><a name="setStandardButtons" />QMessageBox.setStandardButtons (<i>self</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a> <i>buttons</i>)</h3><h3 class="fn"><a name="setText" />QMessageBox.setText (<i>self</i>, QString)</h3><h3 class="fn"><a name="setTextFormat" />QMessageBox.setTextFormat (<i>self</i>, <a href="qt.html#TextFormat-enum">Qt.TextFormat</a>)</h3><h3 class="fn"><a name="setWindowModality" />QMessageBox.setWindowModality (<i>self</i>, <a href="qt.html#WindowModality-enum">Qt.WindowModality</a> <i>windowModality</i>)</h3><p>This function shadows <a href="qwidget.html#windowModality-prop">QWidget.setWindowModality</a>().</p>
<p>Sets the modality of the message box to
<i>windowModality</i>.</p>
<p>On Mac OS X, if the modality is set to <a href="qt.html#WindowModality-enum">Qt.WindowModal</a> and the message
box has a parent, then the message box will be a <a href="qt.html#WindowType-enum">Qt.Sheet</a>, otherwise the message box
will be a standard dialog.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="setWindowTitle" />QMessageBox.setWindowTitle (<i>self</i>, QString <i>title</i>)</h3><p>This function shadows <a href="qwidget.html#windowTitle-prop">QWidget.setWindowTitle</a>().</p>
<p>Sets the title of the message box to <i>title</i>. On Mac OS X,
the window title is ignored (as required by the Mac OS X
Guidelines).</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="showEvent" />QMessageBox.showEvent (<i>self</i>, <a href="qshowevent.html">QShowEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#showEvent">QWidget.showEvent</a>().</p>
<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QMessageBox.sizeHint (<i>self</i>)</h3><h3 class="fn"><a name="standardButton" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.standardButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a> <i>button</i>)</h3><p>Returns the standard button enum value corresponding to the
given <i>button</i>, or <a href="qmessagebox.html#StandardButton-enum">NoButton</a> if the given
<i>button</i> isn't a standard button.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#button">button</a>()
and <a href="qmessagebox.html#standardButtons-prop">standardButtons</a>().</p>
<h3 class="fn"><a name="standardButtons" /><a href="qmessagebox-standardbuttons.html">StandardButtons</a> QMessageBox.standardButtons (<i>self</i>)</h3><h3 class="fn"><a name="standardIcon" /><a href="qpixmap.html">QPixmap</a> QMessageBox.standardIcon (<a href="qmessagebox.html#Icon-enum">Icon</a> <i>icon</i>)</h3><h3 class="fn"><a name="text" />QString QMessageBox.text (<i>self</i>)</h3><h3 class="fn"><a name="textFormat" /><a href="qt.html#TextFormat-enum">Qt.TextFormat</a> QMessageBox.textFormat (<i>self</i>)</h3><h3 class="fn"><a name="warning" /><a href="qmessagebox.html#StandardButton-enum">StandardButton</a> QMessageBox.warning (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, <a href="qmessagebox-standardbuttons.html">StandardButtons</a> <i>buttons</i> = QMessageBox.Ok, <a href="qmessagebox.html#StandardButton-enum">StandardButton</a> <i>defaultButton</i> = QMessageBox.NoButton)</h3><p>Opens a warning message box with the given <i>title</i> and
<i>text</i> in front of the specified <i>parent</i> widget.</p>
<p>The standard <i>buttons</i> are added to the message box.
<i>defaultButton</i> specifies the button used when <b>Enter</b> is
pressed. <i>defaultButton</i> must refer to a button that was given
in <i>buttons</i>. If <i>defaultButton</i> is <a href="qmessagebox.html#StandardButton-enum">QMessageBox.NoButton</a>,
<a href="qmessagebox.html">QMessageBox</a> chooses a suitable
default automatically.</p>
<p>Returns the identity of the standard button that was clicked. If
<b>Esc</b> was pressed instead, the <a href="qmessagebox.html#default-and-escape-keys">escape button</a> is
returned.</p>
<p>The message box is an <a href="qt.html#WindowModality-enum">application modal</a> dialog box.</p>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
of the dialog. If you want to do this, you should create the dialog
yourself using one of the <a href="qmessagebox.html">QMessageBox</a> constructors.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qmessagebox.html#question">question</a>(), <a href="qmessagebox.html#information">information</a>(), and <a href="qmessagebox.html#critical">critical</a>().</p>
<h3 class="fn"><a name="warning-2" />int QMessageBox.warning (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, int <i>button0</i>, int <i>button1</i>, int <i>button2</i> = 0)</h3><h3 class="fn"><a name="warning-3" />int QMessageBox.warning (<a href="qwidget.html">QWidget</a> <i>parent</i>, QString <i>title</i>, QString <i>text</i>, QString <i>button0Text</i>, QString <i>button1Text</i> = '', QString <i>button2Text</i> = '', int <i>defaultButtonNumber</i> = 0, int <i>escapeButtonNumber</i> = -1)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="buttonClicked" />void buttonClicked ( ::QAbstractButton*)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever a button is clicked inside the
<a href="qmessagebox.html">QMessageBox</a>. The button that was
clicked in returned in <i>button</i>.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|