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

QKeySequence::toString() returns garbage strings for some simple QKeySequence

    XMLWordPrintable

Details

    • All, macOS, Windows
    • d83441340c (qt/qtbase/dev) d83441340c (qt/tqtc-qtbase/dev)

    Description

      Summary:

      QKeySequence::toString() returns garbage strings for some simple QKeySequence like Qt::Key_Shift, Qt::Key_Control, Qt::Key_Mode_switch, ... The issue can be reproduced on macOS 10.13.6 as well as on Windows 10.

       

      Steps to reproduce (macOS):

      1. Download the attached application GarbageKeySequenceDescription: GarbageKeySequenceDescription.zip
      2. Compile the application on macOS 10.13.6 and run it

      Result: You see garbage strings for Key_Shift, Key_Control and Key_Mode_switch:

       

      Key_Left: 
      portableKey: "Left"
      nativeKey: "←"
      
      Key_Shift: 
      portableKey: "ៀ\uDC20"
      nativeKey: "⇧"
      
      Key_Control: 
      portableKey: "ៀ\uDC21"
      nativeKey: "⌘"
      
      Key_Mode_switch: 
      portableKey: "ោ\uDD7E"
      nativeKey: "ោ\uDD7E"
      

       

      Steps to reproduce (Windows 10):

      1. Download the attached application GarbageKeySequenceDescription: 
      2. Compile the application on Windows 10 and run it

      Result: You see garbage strings for Key_Shift, Key_Control and Key_Mode_switch:

      Key_Left: 
      portableKey: "Left"
      nativeKey: "Left"
      
      Key_Shift: 
      portableKey: "?\uDC20"
      nativeKey: "?\uDC20"
      
      Key_Control: 
      portableKey: "?\uDC21"
      nativeKey: "?\uDC21"
      
      Key_Mode_switch: 
      portableKey: "?\uDD7E"
      nativeKey: "?\uDD7E"

       

      More information:

      The code simply does the following:

      QString nativeKey = QKeySequence(Qt::Key_Shift).toString(QKeySequence::NativeText);
      qDebug() << "nativeKey: " << nativeKey;
      

       

      Expected: 

      QKeySequence::toString() should never return a garbage string. It should return an empty string if it can't provide a valid description.

      Attachments

        Issue Links

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

          Activity

            People

              lpapp Laszlo Papp
              jirauser46068 user-e3f1a (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes