Skip to content

Commit 6c97885

Browse files
committed
pqmon: Reset PQEvents button.
Signed-off-by: andreidanila1 <[email protected]>
1 parent 4bd057e commit 6c97885

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

packages/pqmon/plugins/pqm/include/pqm/harmonicsinstrument.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,18 @@ public Q_SLOTS:
5656
void stop();
5757
void toggleHarmonics(bool en);
5858
void onAttrAvailable(QMap<QString, QMap<QString, QString>> attr);
59+
5960
Q_SIGNALS:
6061
void enableTool(bool en, QString toolName = HARMONICS_TOOL);
6162
void logData(PqmDataLogger::ActiveInstrument instr, const QString &filePath);
6263
void pqEvent();
6364
void showPlots(bool show);
6465

66+
// Emitted when this instrument requests other instruments to reset their event buttons
67+
void resetEventsRequest();
68+
// Received signal to reset this instrument's event button
69+
void resetEventsBtn();
70+
6571
private Q_SLOTS:
6672
void updateTable();
6773
void onActiveChnlChannged(QString chnlId);

packages/pqmon/plugins/pqm/include/pqm/rmsinstrument.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ class SCOPY_PQM_EXPORT RmsInstrument : public QWidget
4949
void enableTool(bool en, QString toolName = RMS_TOOL);
5050
void logData(PqmDataLogger::ActiveInstrument instr, const QString &filePath);
5151

52+
// Emitted when this instrument requests other instruments to reset their event buttons
53+
void resetEventsRequest();
54+
// Received signal to reset this instrument's event button
55+
void resetEventsBtn();
56+
5257
public Q_SLOTS:
5358
void stop();
5459
void toggleRms(bool en);

packages/pqmon/plugins/pqm/src/harmonicsinstrument.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ HarmonicsInstrument::HarmonicsInstrument(ToolMenuEntry *tme, QString uri, QWidge
122122
pqEventsBtn->setChecked(m_running);
123123
}
124124
});
125+
connect(this, &HarmonicsInstrument::resetEventsBtn, this, [this, pqEventsBtn]() {
126+
if(pqEventsBtn->isChecked()) {
127+
pqEventsBtn->setChecked(false);
128+
}
129+
});
125130

126131
tool->addWidgetToCentralContainerHelper(scrollArea);
127132
tool->addWidgetToTopContainerHelper(m_runBtn, TTA_RIGHT);
@@ -462,6 +467,7 @@ QPushButton *HarmonicsInstrument::createPQEventsBtn(QWidget *parent)
462467
btn->setIcon(bellIcon);
463468
btn->setLayoutDirection(Qt::RightToLeft);
464469
connect(btn, &QPushButton::toggled, btn, &QPushButton::setEnabled);
470+
connect(btn, &QPushButton::clicked, this, &HarmonicsInstrument::resetEventsRequest);
465471

466472
return btn;
467473
}

packages/pqmon/plugins/pqm/src/pqmplugin.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ bool PQMPlugin::onConnect()
214214
&SettingsInstrument::attributeAvailable);
215215
connect(settings, &SettingsInstrument::setAttributes, m_acqManager, &AcquisitionManager::setConfigAttr);
216216

217+
connect(rms, &RmsInstrument::resetEventsRequest, harmonics, &HarmonicsInstrument::resetEventsBtn);
218+
connect(harmonics, &HarmonicsInstrument::resetEventsRequest, rms, &RmsInstrument::resetEventsBtn);
219+
217220
m_attrHandler->setRmsInstrument(rms);
218221
m_attrHandler->setHarmonicsInstrument(harmonics);
219222

packages/pqmon/plugins/pqm/src/rmsinstrument.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ RmsInstrument::RmsInstrument(ToolMenuEntry *tme, QString uri, QWidget *parent)
130130
pqEventsBtn->setChecked(m_running);
131131
}
132132
});
133+
connect(this, &RmsInstrument::resetEventsBtn, this, [this, pqEventsBtn]() {
134+
if(pqEventsBtn->isChecked()) {
135+
pqEventsBtn->setChecked(false);
136+
}
137+
});
133138

134139
tool->addWidgetToTopContainerHelper(m_runBtn, TTA_RIGHT);
135140
tool->addWidgetToTopContainerHelper(m_singleBtn, TTA_RIGHT);
@@ -334,6 +339,7 @@ QPushButton *RmsInstrument::createPQEventsBtn(QWidget *parent)
334339
btn->setIcon(bellIcon);
335340
btn->setLayoutDirection(Qt::RightToLeft);
336341
connect(btn, &QPushButton::toggled, btn, &QPushButton::setEnabled);
342+
connect(btn, &QPushButton::clicked, this, &RmsInstrument::resetEventsRequest);
337343

338344
return btn;
339345
}

0 commit comments

Comments
 (0)