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

QtQuick MessageDialog: Fails on macOS when using richtext

    XMLWordPrintable

Details

    • macOS
    • c821284d9 (dev), e0b536e01 (6.8), 37ae99b2c (6.7), 0156061ce (tqtc/lts-6.5)

    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

        For Gerrit Dashboard: QTBUG-124124
        # Subject Branch Project Status CR V

        Activity

          People

            vestbo Tor Arne Vestbø
            njeisecke_qtc Nils Jeisecke
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: