Global keypress handler
-
Hi
What about
http://doc.qt.io/qt-5/qshortcut.html#details
Alternatively there is
http://doc.qt.io/qt-5/qcoreapplication.html#notifyBut can I ask what is the use case ?
-
The UI will be spawned in another process, and show() / hide() will be called on the keypress depending on whether it's currently visible, i tried some stuff (GetKeyState, RegisterHotKey) but keystate is a blocking call and would prevent the UI from working properly, and i couldnt figure out registerhotkey.
I also tired QShortCut already, it requires the UI to be in focus, ill take a look at notify but im affraid that it's also going to require focus.
-
The UI will be spawned in another process, and show() / hide() will be called on the keypress depending on whether it's currently visible, i tried some stuff (GetKeyState, RegisterHotKey) but keystate is a blocking call and would prevent the UI from working properly, and i couldnt figure out registerhotkey.
I also tired QShortCut already, it requires the UI to be in focus, ill take a look at notify but im affraid that it's also going to require focus.
@Mehodin
So its a global OS key handler you are after ?
Like RegisterHotKey ?http://amin-ahmadi.com/2015/11/14/how-to-use-system-wide-hotkeys-in-your-qt-application/
-
Hi
The small sample i liked, worked fine, last time i tried it. ( for other forum poster)
Its only for windows, but i assume thats fine ? -
@Mehodin
The link i gave, but i found the test project from other post :)
https://www.dropbox.com/s/yh7ynoy9k3kzu3l/globalkey.zip?dl=0it just show message box, but you can make it do what ever you want and
app dont need to have focus.