Results 1 to 4 of 4

Thread: Using RegisterHotKey

  1. #1

    Default Using RegisterHotKey

    I have a simple program with a widget. At startup the widget is not shown.

    I want to assign a hotkey ( for instance "ctrl + space" ). So when the user pressses "ctrl + space" the widget is shown.

    I know i can register the hotkey with

    RegisterHotKey(winId(), 100, MOD_CONTROL, VK_SPACE);

    But how do i get and react on the messages windows sends when the user presses "ctrl + space" and should RegisterHotKey(); be place anywhere specific in the code?

  2. #2
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using RegisterHotKey

    Sorry, misunderstood your problem, QShortCut won't install system-wide hotkeys

    But you could always try to implement your own messageFilter.
    "If you lie to the compiler, it will get its revenge." - Henry Spencer

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Using RegisterHotKey

    The message can be caught via QWidget::winEvent().
    J-P Nurmi

  4. #4

    Default Re: Using RegisterHotKey

    Thank you for your answers. I got it to work with QWidget::winEvent().

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.