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 761 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 17 Dec 2018, 09:44 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 1 Reply Last reply 17 Dec 2018, 09:53
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 17 Dec 2018, 09:51 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
        17 Dec 2018, 09:44

        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 Offline
        J Offline
        J.Hilk
        Moderators
        wrote on 17 Dec 2018, 09:53 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 17 Dec 2018, 10:20
        2
        • J J.Hilk
          17 Dec 2018, 09:53

          @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 17 Dec 2018, 10:20 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
          • G Offline
            G Offline
            GrecKo
            Qt Champions 2018
            wrote on 18 Dec 2018, 08:32 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

            2/5

            17 Dec 2018, 09:51

            • Login

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