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

Can't set QMessageBox title on IOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.9.8, 5.12.6, 5.13.2, 5.14.0
    • None
    • iOS/tvOS/watchOS

    Description

      Following piece of code can't set windowTitle on a QMessageBox on IOS:

      auto box = new QMessageBox(this);
      box->setWindowTitle("Title");
      box->setText("Description");
      box->show();
      

      But this one works:

      auto box = new QMessageBox(this);
      box->QWidget::setWindowTitle("Title");
      box->setText("Description");
      box->show();
      

      The problem is simple. You can see the problematic line below, the usage of Q_OS_MAC (which corresponds to Q_OS_DARWIN). Using Q_OS_MACOS instead would solve the problem:

      qtbase/src/widgets/dialogs/qmessagebox.cpp:2610:

      void QMessageBox::setWindowTitle(const QString &title)
      {
          // Message boxes on the mac do not have a title
      #ifndef Q_OS_MAC // ->>>>> Problem here
          QDialog::setWindowTitle(title);
      #else
          Q_UNUSED(title);
      #endif
      }
      

      Tested on iOS Simulator, you can see the attached images.

      Attachments

        1. correct.png
          correct.png
          84 kB
        2. incorrect.png
          incorrect.png
          81 kB

        Issue Links

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

          Activity

            People

              vestbo Tor Arne Vestbø
              kozmon Ömer Göktaş
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes