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

Can't set QMessageBox title on IOS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.9.8, 5.12.6, 5.13.2, 5.14.0
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      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
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            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