Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Alternative zoom in (ctrl + alt + plus)

Alternative zoom in (ctrl + alt + plus)

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 4 Posters 772 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pokemonsrqt
    wrote on last edited by
    #1

    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?

    J.HilkJ 1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I think it should accept QKeySequence-like strings (at least the docs suggest it does), so you can take a look at QKeySequence docs.

      (Z(:^

      1 Reply Last reply
      2
      • P pokemonsrqt

        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?

        J.HilkJ Online
        J.HilkJ Online
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @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.


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        P 1 Reply Last reply
        2
        • J.HilkJ J.Hilk

          @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.

          P Offline
          P Offline
          pokemonsrqt
          wrote on last edited by
          #4

          @J.Hilk

          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.

          1 Reply Last reply
          0
          • GrecKoG Offline
            GrecKoG Offline
            GrecKo
            Qt Champions 2018
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved