Closed cpyarger closed 3 years ago
QHotkey is a standart Qt class with signals and slots. Thus, you can get the sender of a signal via QObject::sender.
basic example (pseudocode)
auto hotkey1 = new QHotkey(...);
auto hotkey2 = new QHotkey(...);
auto hotkey3 = new QHotkey(...);
connect(hotkey1, &QHotkey::activated, this, &MyClass::myCallback);
connect(hotkey2, &QHotkey::activated, this, &MyClass::myCallback);
connect(hotkey3, &QHotkey::activated, this, &MyClass::myCallback);
void MyClass::myCallback() {
auto hotkey = qobject_cast<QHotkey>(QObject::sender());
qDebug() << hotkey.shortcut();
}
Thank you! I stumbled across this a few days back and got it working! Any chance you would be willing to help out with doing the same thing you did here with midi? I have been poking the rtmidi17 library and would to see it have a QT5 implementation
Hi, I am looking to register multiple hotkeys to a single callback. But pass through the qkeysequence and bool pressed to that callback. How would I go about setting that up?