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

ItemDelegate label always uses mnemonics

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12, 6.6.0 RC
    • Quick: Controls 2
    • None

    Description

      The various ItemDelegate/MenuItem/Button implementations internally use QQuickMnemonicLabel to render the text property. While this is ok for Menus and Buttons this causes problems for other use cases when an ItemDelegate is used for showing model data with a ListView (which is the ItemDelegate use case after all).

      The ComboBox implementation also shows this problem, just open the example's combobox popup.

      AbstractButton should have a property that controls whether the default contentItem uses mnemonics or not (defaulting to true for actual button implementations and to false for ItemDelegate etc).

      import QtQuick 2.12
      import QtQuick.Window 2.12
      import QtQuick.Controls 2.12
      
      Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
      
        ListView {
          anchors.fill: parent
          model: ["This & That", "Cat & Dog"]
          delegate: ItemDelegate {
            text: modelData
          }
        }
      
        ComboBox {
          anchors.centerIn: parent
          model: ["This & That", "Cat & Dog"]
        }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              njeisecke Nils Jeisecke
              Votes:
              5 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change