Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Shortcut how handle permanent key press action
Qt 6.11 is out! See what's new in the release blog

Shortcut how handle permanent key press action

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 528 Views 2 Watching
  • 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.
  • gfxxG Offline
    gfxxG Offline
    gfxx
    wrote on last edited by
    #1

    I would like to use a shortcut on a PushButton ... PushButton is linked to a pressed action and released action function .... I make a shortcut with the F10 key .... but I would like the PushButto to remain in pressed state as long as the F10 key is pressed .... now if I hold down F10 I get a series of PushButton pressed and released actions ....

    Override keypressEvent and keyReleaseEvent not help .....

    thanks a lot for any cuggest

    bkt

    Pl45m4P 1 Reply Last reply
    0
    • gfxxG gfxx

      I would like to use a shortcut on a PushButton ... PushButton is linked to a pressed action and released action function .... I make a shortcut with the F10 key .... but I would like the PushButto to remain in pressed state as long as the F10 key is pressed .... now if I hold down F10 I get a series of PushButton pressed and released actions ....

      Override keypressEvent and keyReleaseEvent not help .....

      thanks a lot for any cuggest

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @gfxx said in Shortcut how handle permanent key press action:

      Override keypressEvent and keyReleaseEvent not help .....

      But that's the only way...
      QShortcut cant differentiate between press and release...

      Override press- and releaseEvent and keep your button in pressed/down state, until you get a F10-keyReleaseEvent.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      3
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by Kent-Dorfman
        #3

        I like software layering...an alternate approach that I would use would be to create a custom pushbutton that provides the behavior. pushbuttons have an abstract base interface. Start there or look at subclassing QPushbutton.

        The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

        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