diff --git a/QHotkey b/QHotkey index 2578b69..91f3542 160000 --- a/QHotkey +++ b/QHotkey @@ -1 +1 @@ -Subproject commit 2578b69dc51e3786402777e650181c5735015e1a +Subproject commit 91f3542b5d11a6df8e5735ef03f336c399ceab93 diff --git a/hotkeying.cpp b/hotkeying.cpp index dd4ec7c..17288ca 100644 --- a/hotkeying.cpp +++ b/hotkeying.cpp @@ -5,18 +5,21 @@ #include QMap hotkeys; -QList regNames; // func gets bound only on first set, or load void hotkeying::hotkey(QString seqName, QKeySequence seq, std::function func) { + QHotkey *hotkey; if (hotkeys.contains(seqName)) - hotkeys.value(seqName)->setShortcut(seq, true); + (hotkey = hotkeys.value(seqName))->setShortcut(seq, true); else { - QHotkey *hotkey = new QHotkey(seq, true); + hotkey = new QHotkey(seq, true); QObject::connect(hotkey, &QHotkey::activated, func); hotkeys.insert(seqName, hotkey); } settings::settings().setValue(seqName.prepend("hotkey_"), seq.toString()); + if (!hotkey->isRegistered() && !seq.toString().isEmpty()) + qWarning().noquote().nospace() + << "Could not bind the hotkey " << seqName << "! Is the keybind already registered?"; } // forces the hotkey from settings @@ -31,6 +34,9 @@ void hotkeying::load(QString seqName, std::function func, QString def) { h = new QHotkey(def.isNull() ? "" : def, true); QObject::connect(h, &QHotkey::activated, func); hotkeys.insert(seqName, h); + if (!h->isRegistered() && (settings::settings().contains(name) || !def.isEmpty())) + qWarning().noquote().nospace() + << "Could not bind the hotkey " << seqName << "! Is the keybind already registered?"; } bool hotkeying::valid(QString seq) {