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

Can't set QMessageBox title on IOS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.9.8, 5.12.6, 5.13.2, 5.14.0
    • None
    • iOS/tvOS/watchOS

      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.

        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.

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

              Created:
              Updated:

                There are no open Gerrit changes