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

add ShortcutGroup

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • None

    Description

      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.

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              srutledg Shawn Rutledge
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes