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

KeyEvent code|modifiers returns something strange in QKeySequence

    XMLWordPrintable

Details

    • Windows

    Description

      (UK Keyboard layout where = and + are on the same key with + accessed with shift.)

      I have read the documentation on QKeySequence and the hungarian keyboard example however there appears to be missing documentation or apis or something?

       

      From a key event I can either:

      • combine code|modifiers in to a QKeySequence and get the toString in a portable format and save this; or
      • use the event.text

      Neither of these approaches are entirely good because for example I want to be able to distinguish between:

      • 'A' and 'Shift+A'

      For this one I can use QKeySequence.

      • '=' and '+'.

      For this one I could use QKeySequence, but I end up with the string "Shift++".

      Or similarly, `'` and `@` would result in `shift+@` which may seem somewhat counter to what users might expect? (Indeed QtCreator doesn't show it like this either)

      A better solution for these keys might be to store the actual resulting key (like in the hungarian example), so for `` / `shift=` we could store just the `=` as given by event.text.

      The problem here though is how to differentiate between these two scenarios?

      I note that QtCreator has somehow manged to bridge this gap, how is this achieved?

      (I pressed `A`, `Shift+A`, `=`, `Shift+=`, but QtCreator converted that last one in to the resulting key `+`)

      The other problem come from non-printable keys such as arrow keys and tab.

      How can these be easily filtered so we can decide to use one or the other of the above techniques?

      Or is there some third way?

      Attachments

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

        Activity

          People

            srutledg Shawn Rutledge
            Dynite Michael Cox
            Votes:
            4 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes