From 960601b8fe217d9e3b25cf26f47f36bd3c3522a6 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 25 Sep 2014 11:35:50 +0000 Subject: [PATCH] Fix several issues with shortcut keys. Do not drop through shortcut key handling so that spurious responses are avoided. The keyPressEvent handlers must call the super class implementation if the event os not handled. Correct a typo in the shortcut help display. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4361 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 46 +++++++++++++++++++++++++++++++--------------- shortcuts.txt | 2 +- widegraph.cpp | 2 +- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index f50bc5fec..9b035bdad 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -717,46 +717,54 @@ void MainWindow::auto_tx_mode (bool state) void MainWindow::keyPressEvent( QKeyEvent *e ) //keyPressEvent { + qDebug () << "key: " << e->key () << " modifiers: " << e->modifiers (); int n; switch(e->key()) { case Qt::Key_1: if(e->modifiers() & Qt::AltModifier) { on_txb1_clicked(); - break; + e->ignore (); + return; } + break; case Qt::Key_2: if(e->modifiers() & Qt::AltModifier) { on_txb2_clicked(); - break; + return; } + break; case Qt::Key_3: if(e->modifiers() & Qt::AltModifier) { on_txb3_clicked(); - break; + return; } + break; case Qt::Key_4: if(e->modifiers() & Qt::AltModifier) { on_txb4_clicked(); - break; + return; } + break; case Qt::Key_5: if(e->modifiers() & Qt::AltModifier) { on_txb5_clicked(); - break; + return; } + break; case Qt::Key_6: if(e->modifiers() & Qt::AltModifier) { on_txb6_clicked(); - break; + return; } + break; case Qt::Key_D: if(e->modifiers() & Qt::ShiftModifier) { if(!m_decoderBusy) { jt9com_.newdat=0; jt9com_.nagain=0; decode(); - break; + return; } } break; @@ -766,22 +774,23 @@ void MainWindow::keyPressEvent( QKeyEvent *e ) //keyPressEvent genStdMsgs(""); m_ntx=6; ui->txrb6->setChecked(true); - break; + return; case Qt::Key_F6: if(e->modifiers() & Qt::ShiftModifier) { on_actionDecode_remaining_files_in_directory_triggered(); + return; } break; case Qt::Key_F11: n=11; if(e->modifiers() & Qt::ControlModifier) n+=100; bumpFqso(n); - break; + return; case Qt::Key_F12: n=12; if(e->modifiers() & Qt::ControlModifier) n+=100; bumpFqso(n); - break; + return; case Qt::Key_F: if(e->modifiers() & Qt::ControlModifier) { if(ui->tabWidget->currentIndex()==0) { @@ -791,30 +800,37 @@ void MainWindow::keyPressEvent( QKeyEvent *e ) //keyPressEvent ui->freeTextMsg->clearEditText(); ui->freeTextMsg->setFocus(); } - break; + return; } + break; case Qt::Key_G: if(e->modifiers() & Qt::AltModifier) { genStdMsgs(m_rpt); - break; + return; } + break; case Qt::Key_H: if(e->modifiers() & Qt::AltModifier) { on_stopTxButton_clicked(); - break; + return; } + break; case Qt::Key_L: if(e->modifiers() & Qt::ControlModifier) { lookup(); genStdMsgs(m_rpt); - break; + return; } + break; case Qt::Key_V: if(e->modifiers() & Qt::AltModifier) { m_fileToSave=m_fname; - break; + return; } + break; } + + QMainWindow::keyPressEvent (e); } void MainWindow::bumpFqso(int n) //bumpFqso() diff --git a/shortcuts.txt b/shortcuts.txt index 30a1e6bc9..1062bb1fb 100644 --- a/shortcuts.txt +++ b/shortcuts.txt @@ -19,7 +19,7 @@ Ctrl+F Edit the free text message box Alt+G Generate standard messages Alt+H Halt Tx Ctrl+L Lookup callsign in database, generate standard messages -Alt M Monitor +Alt+M Monitor Alt+N Enable Tx Alt+Q Log QSO Alt+S Stop monitoring diff --git a/widegraph.cpp b/widegraph.cpp index d5d13d1f5..b4874340d 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -208,7 +208,7 @@ void WideGraph::keyPressEvent(QKeyEvent *e) emit f11f12(n); break; default: - e->ignore(); + QDialog::keyPressEvent (e); } }