From d8f5f9b291135974491e8c3b5c8762c1e2ed73fd Mon Sep 17 00:00:00 2001 From: ArsenArsen Date: Sat, 13 May 2017 18:50:54 +0200 Subject: [PATCH] Make sure `Cancel` does not reset the hotkey. --- mainwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 37795b2..c83001a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -152,8 +152,9 @@ void MainWindow::on_hotkeys_doubleClicked(const QModelIndex &) { if (ui->hotkeys->selectedItems().length() == 1) { QListWidgetItem *i = ui->hotkeys->selectedItems().at(0); QString str = i->data(Qt::UserRole + 1).toString(); + bool ok; QString seq = QInputDialog::getText(ui->centralWidget, "Hotkey Input", "Insert hotkey:", QLineEdit::Normal, - hotkeying::sequence(str)); - if (hotkeying::valid(seq)) hotkeying::hotkey(str, QKeySequence(seq), *fncs.value(str)); + hotkeying::sequence(str), &ok); + if (ok && hotkeying::valid(seq)) hotkeying::hotkey(str, QKeySequence(seq), *fncs.value(str)); } }