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)); } }