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

add ShortcutGroup



    • Type: Suggestion
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:


      This idea is a result of QTBUG-56562. Text copied in:

      You might need to disable all of them except for certain ones. E.g. on macOS there are some shortcuts corresponding to menu items that are supposed to be still enabled while a dialog is open (an old bug which we fixed once, then it immediately got broken again and still is, AFAIK). Or, maybe the popup needs different shortcut assignments... so maybe the shortcuts need some group or category property (string? id?) which can be enabled/disabled together somehow.

      Likewise I imagine in complex apps, shortcuts should be contextual. So this group or category would be diffferent in different contexts. Imagine making something like Creator: some shortcuts are valid only in the context of debugging, others only in the editor, and so on. Oops we can't call it a context though... that's an enum in Shortcut already.

      Next question is how to enable/disable them declaratively. Something like (handwaving)

      Item {
          Shortcuts.groupEnabled("editorTab"): visible
          TextEditor { ... }

      except that attached properties don't usually have constructor parameters like that... so I guess it has to be something different. Would be nice if it could somehow be a one-liner, though.

      Item {
          id: editorPane
          ShortcutGroup {
              id: editorGroup
              enabled: editorPane.visible
          Editor {
              Shortcut {
                   group: editorGroup
                   sequence: StandardKey.Paste
                   onActivated: editor.paste()

      keeping in mind that imported components declare shortcuts... so they are not directly in scope.


          Issue Links

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



              srutledg Shawn Rutledge
              srutledg Shawn Rutledge
              0 Vote for this issue
              1 Start watching this issue



                  Gerrit Reviews

                  There are no open Gerrit changes