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. Catching WM_HOTKEY events
Forum Updated to NodeBB v4.3 + New Features

Catching WM_HOTKEY events

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 908 Views 1 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.
  • F Offline
    F Offline
    fname
    wrote on last edited by
    #1

    Hi, first I should specify that I'm using PySide on Windows. I'm rigging together a custom global hotkey solution (there aren't many existing libraries that have support for global hotkeys) on Win32, which is pretty easy to do. I already have it so that Windows sends my application a standard WM_HOTKEY event (message ID=786). I've tried a few ways of catching this event. The first way, which actually worked when using PyQt4, was using QAbstractEventDispatcher with setEventFilter, as exemplified "here":http://www.riverbankcomputing.com/pipermail/pyqt/2011-March/029449.html. When message.message is 786, access message.wParam to get the details of which global hotkey was pressed. Success!

    However, PySide for some reason does not have a setEventFilter function, so I went looking for other solutions. Installing an event filter on my main window failed, it never gets any messages at all at the point in time at which I press the hotkey (although it does get messages when any non-global-hotkey keys are pressed).

    I also failed to create a custom event loop. I can create a loop to call app.processEvents() instead of using app.exec() directly, but what I really need is an infinite loop to catch Win32 events using GetMessage(), which doesn't really work with my existing loop.

    Right now, I'm out of ideas. If only PySide had setEventFilter support... What do you think? Is there some way to catch the WM_HOTKEY event?

    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