Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-39334

[REG 4->5.2] QMessageBox does not have button for closing if detailedText is set - addButton removes button

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.3.1
    • 5.2.1, 5.3.0
    • None
    • Ubuntu 12.04 LTS 64 bit
      Windows 7 64 bit
    • a149d2f73ec45084c589ef4211974ba50c0d4631. (4.6.2014, stable, 5.3.2?)

    Description

      Create a simple message box:

          QMessageBox msgBox;
          msgBox.setText("Hey yo!");
          msgBox.exec();
      

      It will look like this:

      Now add detailedText to the message box:

          QMessageBox msgBox;
          msgBox.setText("Hey yo!");
          msgBox.setDetailedText("Boring...");
          msgBox.exec();
      

      Now it will look like this:

      The "OK" button is gone. Pressing "Return" or "Escape" will show/hide the details.

      Even when detailed text is available, the dialog should always have a button for properly closing it. By default, this should be the "OK" button. Pressing "Escape" should never show more details.

      This is a regression as it works correctly in Qt 4.8.6 and 5.0.1.

      This can be worked around by passing QMessageBox::Ok to the message box' ctor.

      Update: This happens because calling QMessageBox::addButton removes the default button. Although this has already been the case in Qt 4.8.6, I think it is a bug because it is counter-intuitive and not even documented.

      Attachments

        1. qtbug39334.zip
          1 kB
        2. withDetail.png
          withDetail.png
          5 kB
        3. withoutDetail.png
          withoutDetail.png
          5 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              rlohning Robert Löhning
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes