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

Provide a getter for StandardKey in QKeySequence

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • P2: Important
    • Some future release
    • 4.4.0
    • Other
    • None

    Description

      QKeySequence can be set with StandardKey (we have a constructor for it). However, later if we have QKeySequence instance we cannot retrieve a StandardKey from it.

      The case is QDesigner. People want to set a StandardKey in designer. We cannot just save its key-combination in ui file because it can be a different combination on every platform. We need to generate a code like:
      setShortcut(QKeySequence(QKeySequence::Undo));
      In this way every platform will get its own key combination for Undo, and we have one ui file for all platforms.

      The suggestion is to provide something like:
      StandardKey QKeySequence::standardKey() const;
      which would return a standard key which was used while creating a QKeysequence with a standard key. If a KeySequence was created with other constructors return UnknownKey.

      Rejected:
      This suggestion is rejected because, while it is trivial to add such a getter it is conceptually incorrect. A keysequence can only represent a single key binding, where as a standardKey can have several. It is thus difficult to say that a specific keySequence represents a standardKey. In fact as the constructor for QKeySequence says, it will only use the primary key.

      Attachments

        Issue Links

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

          Activity

            People

              bachewii Jens
              jkobus Jarek Kobus
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes