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

Improve API around shortcut key sequences

    XMLWordPrintable

Details

    Description

      In QAction

      QAction has a property called "shortcut" and related methods shortcut(), shortcuts(), setShortcut(), and setShortcuts().

      These names imply the involvement of QShortcut, but actually the "shortcut" property holds the primary QKeySequence.

      In QShortcut

      QShortcut has a property called "key" and related methods key() and setKey().

      These names imply a singular key, but actually the "key" property holds a QKeySequence (multiple keys).

      In QML Shortcut

      Shortcut has 2 properties called "sequence" and "sequences". Their 'setters' are analogous to QAction::setShortcut() and QAction::setShortcuts()

       

      Main suggestion

      Use more consistent and unambiguous property/accessor names; unify the Widget versions with their QML counterparts.

      Possible candidates:

      • QShortcut::setKeySequence(const QKeySequence &)
      • QAction::setPrimaryKeySequence(const QKeySequence &)
      • QAction::setKeySequences(const QList<QKeySequence> &)

       

      • Shortcut.primaryKeySequence
      • Shortcut.keySequences

      Secondary suggestion

      Revisit the design, naming, and relationships between QMenu, QAction, QKeySequence, QShortcut. (For example: Should an "Action" be checkable? Should an "Action" have a menu role?)

      Keep the Widget versions consistent with their QML counterparts.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes