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. Register key events when app is minimized

Register key events when app is minimized

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 233 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.
  • M Offline
    M Offline
    MrBeep
    wrote on last edited by
    #1

    Is there a way to register key events when the windows is not in focus / minimized? I know this is possible using :

    if (GetAsyncKeyState(VK_RSHIFT)) {
        //Code here
    }
    

    So when you press Right shift even when the app is minimized it runs the code inside.

    But is there a way to do this in Qt by using QKeyEvent?

    The reason i am not using GetAsyncKeyState is because for some reason it ignores an if statement :

    if (*Condition* == true) {
        if (GetAsyncKeyState(VK_RSHIFT)) {
            //Code here
        }
    }
    

    So as an example in the code above, It already sets the code to true for the GetAsyncKeyState even though the first if statement is false so when the condition of the first if statement is true it already runs the code inside the second if statement because i pressed the key once before no matter when i did it.

    Thanks in advance!

    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