Clear Hotkeys on Exit
This commit is contained in:
parent
d3d3f1e833
commit
aa77c14a51
@ -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) {
|
bool hotkeying::valid(QString seq) {
|
||||||
return seq.isEmpty() || !QKeySequence(seq).toString().isEmpty();
|
return seq.isEmpty() || !QKeySequence(seq).toString().isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ namespace hotkeying {
|
|||||||
void hotkey(QString seqName, QKeySequence seq, std::function<void()> func);
|
void hotkey(QString seqName, QKeySequence seq, std::function<void()> func);
|
||||||
bool valid(QString seq);
|
bool valid(QString seq);
|
||||||
void load(QString seqName, std::function<void()> func, QString def = QString());
|
void load(QString seqName, std::function<void()> func, QString def = QString());
|
||||||
|
void clearAll();
|
||||||
QString sequence(QString seqName);
|
QString sequence(QString seqName);
|
||||||
} // namespace hotkeying
|
} // namespace hotkeying
|
||||||
|
|
||||||
|
@ -205,6 +205,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::quit() {
|
void MainWindow::quit() {
|
||||||
|
hotkeying::clearAll();
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user