Skip to content

Registering the same shortcut twice prompts successful registration? #100

@XMuli

Description

@XMuli

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions