Clear Hotkeys on Exit

This commit is contained in:
Niklas 2020-02-23 13:54:09 +01:00
parent d3d3f1e833
commit aa77c14a51
3 changed files with 9 additions and 0 deletions

View File

@ -41,6 +41,13 @@ void hotkeying::load(QString seqName, std::function<void()> func, QString def) {
;
}
void hotkeying::clearAll() {
for(QString e : hotkeys.keys()) {
QHotkey *hk = hotkeys.value(e);
hk->setRegistered(false);
}
}
bool hotkeying::valid(QString seq) {
return seq.isEmpty() || !QKeySequence(seq).toString().isEmpty();
}

View File

@ -9,6 +9,7 @@ namespace hotkeying {
void hotkey(QString seqName, QKeySequence seq, std::function<void()> func);
bool valid(QString seq);
void load(QString seqName, std::function<void()> func, QString def = QString());
void clearAll();
QString sequence(QString seqName);
} // namespace hotkeying

View File

@ -205,6 +205,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
}
void MainWindow::quit() {
hotkeying::clearAll();
QApplication::quit();
}