Skip to content

Commit b802ab8

Browse files
committed
added cursors
1 parent 8637ada commit b802ab8

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

packages/generic-plugins/plugins/adc/src/adcfftinstrumentcontroller.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,15 @@ void ADCFFTInstrumentController::init()
6060
connect(m_ui->m_cursor->button(), &QAbstractButton::toggled, hoverSettings, &HoverWidget::setVisible);
6161

6262
connect(m_plotComponentManager, &PlotManager::plotAdded, this, [=](uint32_t uuid) {
63-
auto cursorController = m_plotComponentManager->plot(uuid)->cursor();
63+
auto fftPlt = dynamic_cast<FFTPlotComponent *>(m_plotComponentManager->plot(uuid));
64+
65+
auto cursorController = fftPlt->cursor();
6466
cursorController->connectSignals(m_cursorSettings);
6567
connect(m_ui->m_cursor, &QAbstractButton::toggled, cursorController, &CursorController::setVisible);
68+
69+
auto wfCursorController = fftPlt->waterfallCursor();
70+
wfCursorController->connectSignals(m_cursorSettings);
71+
connect(m_ui->m_cursor, &QAbstractButton::toggled, wfCursorController, &CursorController::setVisible);
6672
});
6773

6874
m_fftPlotSettingsComponent = new FFTPlotManagerSettings(dynamic_cast<FFTPlotManager *>(m_plotComponentManager));

packages/generic-plugins/plugins/adc/src/freq/fftplotcomponent.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ FFTPlotComponent::FFTPlotComponent(QString name, uint32_t uuid, QWidget *parent)
9191
m_cursor->getPlotCursors()->setXHandlePos((HandlePos)xCursorPos);
9292
m_cursor->getPlotCursors()->setYHandlePos((HandlePos)yCursorPos);
9393

94+
m_waterfallCursor = new CursorController(m_waterfallPlot, this);
95+
m_waterfallCursor->getPlotCursors()->setXHandlePos((HandlePos)xCursorPos);
96+
m_waterfallCursor->getPlotCursors()->setYHandlePos((HandlePos)yCursorPos);
97+
CursorController::syncXCursorControllers(m_cursor, m_waterfallCursor);
98+
9499
PlotNavigator::syncXNavigators(m_fftPlot->navigator(), m_waterfallPlot->navigator());
95100

96101
}
@@ -142,6 +147,8 @@ FFTPlotComponentSettings *FFTPlotComponent::createPlotMenu(QWidget *parent) { re
142147

143148
FFTPlotComponentSettings *FFTPlotComponent::plotMenu() { return m_plotMenu; }
144149

150+
CursorController *FFTPlotComponent::waterfallCursor() const { return m_waterfallCursor; }
151+
145152
FFTSamplingInfo *FFTPlotComponent::fftPlotInfo() const { return m_fftInfo; }
146153

147154
PlotLegend *FFTPlotComponent::legend() const { return m_legend; }

packages/generic-plugins/plugins/adc/src/freq/fftplotcomponent.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <gui/docking/dockableareainterface.h>
4343
#include <gui/docking/dockwrapperinterface.h>
4444
#include <gui/waterfallplotwidget.h>
45+
#include <gui/cursorcontroller.h>
4546

4647

4748
namespace scopy {
@@ -72,6 +73,8 @@ class SCOPY_ADC_EXPORT FFTPlotComponent : public PlotComponent
7273
FFTSamplingInfo *fftPlotInfo() const;
7374
PlotLegend *legend() const;
7475

76+
CursorController *waterfallCursor() const;
77+
7578
private:
7679
PlotWidget *m_fftPlot;
7780
WaterfallPlotWidget *m_waterfallPlot;
@@ -84,6 +87,8 @@ class SCOPY_ADC_EXPORT FFTPlotComponent : public PlotComponent
8487
DockWrapperInterface *m_waterfallDockWrapper;
8588
PlotLegend *m_legend;
8689

90+
CursorController *m_waterfallCursor;
91+
8792
FFTPlotComponentSettings *m_plotMenu;
8893
};
8994
} // namespace adc

0 commit comments

Comments
 (0)