Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registering the same shortcut twice prompts successful registration? #100

Open
XMuli opened this issue Sep 3, 2024 · 0 comments
Open

Registering the same shortcut twice prompts successful registration? #100

XMuli opened this issue Sep 3, 2024 · 0 comments

Comments

@XMuli
Copy link

XMuli commented Sep 3, 2024

Thank you 😁, this is a great hotkey function repository, thanks for all your hard work.
But I would like to ask a usage.


Supports multiple QHotkey-instances for the same shortcut (with optimisations)

How do I turn off this feature? I want the same shortcut to be registered only once (in the whole OS).


QHotkey* m_hkCapture = new QHotkey(QString("F1"), true, qApp);
QHotkey*  m_hkDelayCapture = new QHotkey(QString("F1"), true, qApp);
qDebug() << m_hkCapture << m_hkCapture->isRegistered() << m_hkCapture->shortcut().toString();
qDebug() << m_hkDelayCapture << m_hkDelayCapture->isRegistered() << m_hkCapture->shortcut().toString();

The results of the run are as follows, all registered successfully, unscientific; not the desired result.
I debugged the relevant source code, but it's not very clear?

[debug] [main 50] QHotkey(0x288f22e10b0) true "F1" 
[debug] [main 51] QHotkey(0x288f22e08d0) true "F1" 

ENV:

Windows 10 22H2
Qt 5.15.2
CMake 3.27.0-rc4
MSVC 2022
X64 bit Debug & Release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant