Results 1 to 2 of 2

Thread: HOWTO after I reimplement winEventFilter to catch the global HOTKEY

  1. #1
    Join Date
    Mar 2010
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question HOWTO after I reimplement winEventFilter to catch the global HOTKEY

    I use the function to register hotkey:
    Qt Code:
    1. void MyApp::registerGlobalKey(){
    2. if(RegisterHotKey(NULL, 10, 0, VK_F10)){
    3. qDebug("VK_F10.");
    4. std::cout << "VK_F10" << std::endl;
    5. }
    6. if(RegisterHotKey(NULL, 11, 0, VK_F11)){
    7. qDebug("VK_F11.");
    8. std::cout << "VK_F11" << std::endl;
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 
    and it works.

    also I reimplement winEventFilter:
    Qt Code:
    1. bool MyApp::winEventFilter(MSG *msg, long *result){
    2. if(WM_HOTKEY == msg->message){
    3. qDebug("hotkey.");
    4. if(msg->wParam == VK_F10)
    5. qDebug("get F10.");
    6. emit getHotKey();
    7. return true;
    8. }
    9. //qDebug("not hotkey.");
    10. return false;
    11. }
    To copy to clipboard, switch view to plain text mode 

    but I don't know what to do later to make it able to catch the system/global hot keys.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: HOWTO after I reimplement winEventFilter to catch the global HOTKEY

    As far as I understand, you have to do the same you did with your own hot keys.
    Register them for your application, and catch them in your winEventFilter().
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    casual0402 (18th March 2010)

Similar Threads

  1. [Solved] Qt Default hotkey for settings
    By 0xl33t in forum Newbie
    Replies: 4
    Last Post: 22nd July 2009, 14:33
  2. How to register a global hotkey?
    By Fazer in forum Qt Programming
    Replies: 1
    Last Post: 17th July 2009, 12:55
  3. systemwide hotkey
    By Screeze in forum Newbie
    Replies: 9
    Last Post: 16th July 2009, 12:43
  4. How to realize the hotKey function?
    By cspp in forum Qt Programming
    Replies: 1
    Last Post: 1st July 2009, 11:12
  5. Setting Hotkey Shortcuts
    By VireX in forum Newbie
    Replies: 8
    Last Post: 4th April 2007, 22:22

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.