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

QtQuick MessageDialog: Fails on macOS when using richtext

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.2, 6.6.3, 6.7.0
    • Quick: Dialogs
    • None
    • macOS

    Description

      The example code will won't show the "richtext" message box on macOS.

      import QtQuick
      import QtQuick.Dialogs
      import QtQuick.Controls
      import QtQuick.Layouts
      
      Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
      
        MessageDialog {
          id: dialogRichText
      
          buttons: MessageDialog.Yes | MessageDialog.No
          text: "Hello <b>World</b>"
        }
      
        MessageDialog {
          id: dialogPlainText
      
          buttons: MessageDialog.Yes | MessageDialog.No
          text: "Hello World"
        }
      
        ColumnLayout {
          Button {
            text: "Rich Text MessageDialog"
            onClicked: dialogRichText.open();
          }
      
          Button {
            text: "Plain Text MessageDialog"
            onClicked: dialogPlainText.open();
          }
        }
      }
      

      Log output:

      qt.quick.dialogs: open called
      qt.quick.dialogs: gHelper attempting to create dialog backend of type 3 with parent window QWindow(0x0)
      qt.qpa.dialogs: Asked to show Qt::WindowModal dialog with parent Main_QMLTYPE_5(0x600000bf0c30)
      qt.qpa.dialogs: Message box contains text in rich text format
      

      This is caused by QCocoaMessageDialog::show returning early in this case.
      The comments say "// Let's fallback to non-native message box,", but no fallback is triggered.

      This is really nasty, especially when the error text could contain user provided input.

       

      Maybe related to QTBUG-104797 or QTBUG-68418.

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            njeisecke_qtc Nils Jeisecke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes