Alternative zoom in (ctrl + alt + plus)
-
I know that I can use the following to trigger zoom in events.
Action { id: zoomIn text: qsTr("Zoom In") shortcut: StandardKey.ZoomIn onTriggered: ... }
But is it possible to trigger an event when StandardKey.ZoomIn + altModifier key are pressed together?
-
I think it should accept QKeySequence-like strings (at least the docs suggest it does), so you can take a look at QKeySequence docs.
-
I know that I can use the following to trigger zoom in events.
Action { id: zoomIn text: qsTr("Zoom In") shortcut: StandardKey.ZoomIn onTriggered: ... }
But is it possible to trigger an event when StandardKey.ZoomIn + altModifier key are pressed together?
@pokemonsrqt doubtful, as the shift modfier is needed on some Keyboards to trigger the ZoomIn "standard key", but you can try it with a KeySequence, like @sierdzio said.
-
@pokemonsrqt doubtful, as the shift modfier is needed on some Keyboards to trigger the ZoomIn "standard key", but you can try it with a KeySequence, like @sierdzio said.
I have also tried to use Keys.onPressed instead of Action. But unfortunately the combination "control + shift + =" on a Mac with english keyboard makes event.key get the value of the = key instead of the + key. So I can't recreate the StandardKey.ZoomIn action from the key press event on Mac.
I will look at KeySequence, but I don't see now how I would get that to work.
-
An alternative would be to still use
shortcut
but query the keyboard modifiers of the app with a singleton type helper wrapping http://doc.qt.io/qt-5/qguiapplication.html#keyboardModifiers