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

Enum type conversion issue

    XMLWordPrintable

Details

    • 1427b243cb69768e7ce2e6ea3ad75619deac104b (qt/qtquickcontrols2/5.12)

    Description

      There is an issue with converting StandardKey enums to native text in shortcuts. The example below is showing the the issue and a workaround to get the native shortcut as a text. Only when converting the actions shortcut explicitly to an int it is possible to get the correct nativeText.

      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")
      
          Action {
              id: action
              text: "Redo"
              shortcut: StandardKey.Copy
          }
      
          Shortcut {
              id: shortcut
              sequence: action.shortcut
          }
      
          Shortcut {
              property int tmp: action.shortcut
              id: shortcutWorkaround
              sequence: tmp
          }
      
          Component.onCompleted: {
              console.log(action.shortcut + " " + shortcut.sequence + " " + shortcut.nativeText)
              console.log(action.shortcut + " " + shortcutWorkaround.sequence + " " + shortcutWorkaround.nativeText)
          }
      }
      
      qml: 9 9 9
      qml: 9 9 Ctrl+C
      

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            henning Henning Gründl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes