From a8feecc51cc4cda123816a7bf1a39aa1a438203b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 18 Oct 2019 13:19:39 +0200 Subject: Properly handle key press events; prevent double-execution --- src/dialog.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/dialog.cpp b/src/dialog.cpp index c6df761..914448f 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -730,12 +730,18 @@ void Dialog::on_helpNewsButton_clicked() { void Dialog::keyPressEvent(QKeyEvent* event) { switch(event->key()) { - case Qt::Key_Return: this->on_pushButtonStart_clicked(); break; - case Qt::Key_Escape: this->on_pushButtonAbort_clicked(); break; - case Qt::Key_H: this->on_helpNewsButton_clicked(); break; - default: break; + case Qt::Key_Return: + event->accept(); + this->on_pushButtonStart_clicked(); + break; + case Qt::Key_Escape: + event->accept(); + this->on_pushButtonAbort_clicked(); + break; + default: + QDialog::keyPressEvent(event); + break; } - QDialog::keyPressEvent(event); } void Dialog::iconDownloaded(const QUrl& url, const QIcon&) { -- cgit v1.2.3-55-g7522