From 42bc00812393ba03fb9c69853a88ff47e585cfff Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 28 Sep 2023 15:44:49 +0100 Subject: [PATCH] Fix a couple of buttons and stop editing of memories when disabled --- memories.cpp | 15 ++++++++++++--- rigcommander.cpp | 2 +- tablewidget.cpp | 2 +- tablewidget.h | 2 ++ wfmain.cpp | 1 + 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/memories.cpp b/memories.cpp index bfdef90..2a3f0a5 100644 --- a/memories.cpp +++ b/memories.cpp @@ -12,6 +12,8 @@ memories::memories(rigCapabilities rigCaps, bool slowLoad, QWidget *parent) : { ui->setupUi(this); ui->table->setColumnCount(totalColumns); + ui->table->editing(false); + QStringList headers; /* @@ -922,7 +924,9 @@ void memories::receiveMemory(memoryType mem) ui->group->setEnabled(true); ui->loadingMemories->setVisible(false); if (!ui->disableEditing->isChecked()) + { ui->table->setEditTriggers(QAbstractItemView::DoubleClicked); + } } timeoutCount=0; // We have received a memory, so set the timeout to zero. @@ -1159,8 +1163,9 @@ void memories::timeout() timeoutTimer.stop(); ui->group->setEnabled(true); if (!ui->disableEditing->isChecked()) + { ui->table->setEditTriggers(QAbstractItemView::DoubleClicked); - + } QMessageBox::information(this,"Timeout", "Timeout receiving memories, check rig connection", QMessageBox::Ok); } } @@ -1399,8 +1404,12 @@ bool memories::readCSVRow(QTextStream &in, QStringList *row) { void memories::on_disableEditing_toggled(bool dis) { - if (dis) + if (dis) { ui->table->setEditTriggers(QAbstractItemView::NoEditTriggers); - else + ui->table->editing(false); + } + else { + ui->table->editing(true); ui->table->setEditTriggers(QAbstractItemView::DoubleClicked); + } } diff --git a/rigcommander.cpp b/rigcommander.cpp index 33addda..285e4d3 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -1979,7 +1979,7 @@ void rigCommander::parseCommand() break; } case funcVFODualWatch: - // Not currently used, but will report the current dual-watch status + value.setValue(static_cast(bool(payloadIn[0]))); break; #if defined __GNUC__ #pragma GCC diagnostic push diff --git a/tablewidget.cpp b/tablewidget.cpp index 249de14..c1646f1 100644 --- a/tablewidget.cpp +++ b/tablewidget.cpp @@ -11,7 +11,7 @@ tableWidget::tableWidget(QWidget *parent): QTableWidget(parent) void tableWidget::mouseReleaseEvent(QMouseEvent *event) { - if(event->button() == Qt::RightButton) + if(event->button() == Qt::RightButton && editingEnabled) { QMenu menu; QAction *add= menu.addAction("Add Item"); diff --git a/tablewidget.h b/tablewidget.h index 3ad7e19..6747006 100644 --- a/tablewidget.h +++ b/tablewidget.h @@ -19,6 +19,7 @@ class tableWidget : public QTableWidget public: explicit tableWidget(QWidget* parent = 0); + void editing(bool val) { editingEnabled = val; }; signals: void rowAdded(int row); @@ -26,6 +27,7 @@ signals: protected: void mouseReleaseEvent(QMouseEvent *event); + bool editingEnabled = true; }; diff --git a/wfmain.cpp b/wfmain.cpp index 50a2125..659e6dc 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3973,6 +3973,7 @@ void wfmain::initPeriodicCommands() queue->add(priorityMedium,funcScopeSubSpeed,true,true); queue->add(priorityMedium,funcScopeMainHold,true,false); queue->add(priorityMedium,funcScopeSubHold,true,true); + queue->add(priorityMedium,funcVFODualWatch,true,false); } if(rigCaps.hasTransmit) {