diff --git a/gui/src/docking/dockableareakdab.cpp b/gui/src/docking/dockableareakdab.cpp index 52820933b6..4ee840bc86 100644 --- a/gui/src/docking/dockableareakdab.cpp +++ b/gui/src/docking/dockableareakdab.cpp @@ -42,6 +42,7 @@ void DockableArea::addDockWrapper(DockWrapperInterface *dockWrapper) { KDDockWidgets::QtWidgets::DockWidget *dockWrapperWidget = dynamic_cast(dockWrapper); + dockWrapperWidget->setAffinities({uniqueName()}); if(dockWrapperWidget) { addDockWidget(dockWrapperWidget, KDDockWidgets::Location_OnRight); } else { diff --git a/plugins/adc/src/freq/fftplotcomponent.cpp b/plugins/adc/src/freq/fftplotcomponent.cpp index 0d03c97dc6..62e0c25779 100644 --- a/plugins/adc/src/freq/fftplotcomponent.cpp +++ b/plugins/adc/src/freq/fftplotcomponent.cpp @@ -36,15 +36,18 @@ using namespace adc; FFTPlotComponent::FFTPlotComponent(QString name, uint32_t uuid, QWidget *parent) : PlotComponent(name, uuid, parent) { - m_fftPlot = new PlotWidget(this); + m_dockableArea = new DockableArea(this); + m_plotLayout->addWidget(m_dockableArea); + m_fftDockWrapper = new DockWrapper("FFT Plot"); + m_fftPlot = new PlotWidget(this); m_fftPlot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_fftPlot->xAxis()->setInterval(0, 1); m_fftPlot->xAxis()->setVisible(true); m_fftPlot->yAxis()->setUnits("dB"); + m_fftDockWrapper->setInnerWidget(m_fftPlot); m_plots.append(m_fftPlot); - m_plotLayout->addWidget(m_fftPlot); auto nameLbl = m_fftPlot->getPlotInfo()->addLabelInfo(IP_LEFT, IP_TOP); nameLbl->setText(m_name); @@ -58,6 +61,7 @@ FFTPlotComponent::FFTPlotComponent(QString name, uint32_t uuid, QWidget *parent) m_plotMenu = new FFTPlotComponentSettings(this, parent); addComponent(m_plotMenu); + m_dockableArea->setAllDockWrappers({m_fftDockWrapper}); connect(m_plotMenu, &FFTPlotComponentSettings::requestDeletePlot, this, [=]() { Q_EMIT requestDeletePlot(); }); m_cursor = new CursorController(m_fftPlot, this); diff --git a/plugins/adc/src/freq/fftplotcomponent.h b/plugins/adc/src/freq/fftplotcomponent.h index f0c2ccd382..1e52ac9121 100644 --- a/plugins/adc/src/freq/fftplotcomponent.h +++ b/plugins/adc/src/freq/fftplotcomponent.h @@ -35,10 +35,11 @@ #include #include -#include "plotinfo.h" #include "plotcomponent.h" #include "fftplotcomponentsettings.h" #include +#include +#include namespace scopy { namespace adc { @@ -65,6 +66,9 @@ class SCOPY_ADC_EXPORT FFTPlotComponent : public PlotComponent PlotWidget *m_fftPlot; FFTSamplingInfo *m_fftInfo; + DockableArea *m_dockableArea; + DockWrapper *m_fftDockWrapper; + FFTPlotComponentSettings *m_plotMenu; }; } // namespace adc diff --git a/plugins/adc/src/time/timeplotcomponent.cpp b/plugins/adc/src/time/timeplotcomponent.cpp index d43b7a9f16..653c1a5f69 100644 --- a/plugins/adc/src/time/timeplotcomponent.cpp +++ b/plugins/adc/src/time/timeplotcomponent.cpp @@ -43,15 +43,22 @@ TimePlotComponent::TimePlotComponent(QString name, uint32_t uuid, QWidget *paren , m_XYXChannel(nullptr) , m_singleYMode(true) { + m_dockableArea = new DockableArea(this); + m_plotLayout->addWidget(m_dockableArea); + + m_timeDockWidget = new DockWrapper("Time Plot"); m_timePlot = new PlotWidget(this); m_timePlot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_timePlot->xAxis()->setInterval(0, 1); m_timePlot->xAxis()->setVisible(true); + m_timeDockWidget->setInnerWidget(m_timePlot); + m_xyDockWidget = new DockWrapper("XY Plot"); m_xyPlot = new PlotWidget(this); m_xyPlot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_xyPlot->xAxis()->setInterval(-2048, 2048); m_xyPlot->xAxis()->setVisible(true); + m_xyDockWidget->setInnerWidget(m_xyPlot); m_plots.append(m_timePlot); m_plots.append(m_xyPlot); @@ -70,15 +77,14 @@ TimePlotComponent::TimePlotComponent(QString name, uint32_t uuid, QWidget *paren [=]() { m_info->update(m_currentSamplingInfo); }); */ - m_plotLayout->addWidget(m_timePlot); - m_plotLayout->addWidget(m_xyPlot); - // Need to set this for some reason .. spinboxes should be refactored m_timePlot->yAxis()->setUnits("V"); m_plotMenu = new TimePlotComponentSettings(this, parent); addComponent(m_plotMenu); + m_dockableArea->setAllDockWrappers({m_timeDockWidget, m_xyDockWidget}); + connect(m_plotMenu, &TimePlotComponentSettings::requestDeletePlot, this, [=]() { Q_EMIT requestDeletePlot(); }); m_cursor = new CursorController(m_timePlot, this); } @@ -220,3 +226,7 @@ bool TimePlotComponent::singleYMode() const { return m_singleYMode; } TimePlotComponentSettings *TimePlotComponent::createPlotMenu(QWidget *parent) { return m_plotMenu; } TimePlotComponentSettings *TimePlotComponent::plotMenu() { return m_plotMenu; } + +DockWrapper *TimePlotComponent::timeDockWidget() const { return m_timeDockWidget; } + +DockWrapper *TimePlotComponent::xyDockWidget() const { return m_xyDockWidget; } diff --git a/plugins/adc/src/time/timeplotcomponent.h b/plugins/adc/src/time/timeplotcomponent.h index 8fe0cbbf30..e76d9a7769 100644 --- a/plugins/adc/src/time/timeplotcomponent.h +++ b/plugins/adc/src/time/timeplotcomponent.h @@ -38,6 +38,8 @@ #include "plotinfo.h" #include #include +#include +#include namespace scopy { namespace adc { @@ -74,6 +76,9 @@ public Q_SLOTS: TimePlotComponentSettings *createPlotMenu(QWidget *parent); TimePlotComponentSettings *plotMenu(); + DockWrapper *timeDockWidget() const; + DockWrapper *xyDockWidget() const; + bool singleYMode() const; TimeSamplingInfo *timePlotInfo() const; @@ -96,6 +101,10 @@ private Q_SLOTS: TimeSamplingInfo *m_timePlotInfo; const float *xyXData; + DockableArea *m_dockableArea; + DockWrapper *m_timeDockWidget; + DockWrapper *m_xyDockWidget; + private: QMetaObject::Connection xyDataConn; QMetaObject::Connection xyAxisMinConn; diff --git a/plugins/adc/src/time/timeplotcomponentsettings.cpp b/plugins/adc/src/time/timeplotcomponentsettings.cpp index 273fe95932..62084070d8 100644 --- a/plugins/adc/src/time/timeplotcomponentsettings.cpp +++ b/plugins/adc/src/time/timeplotcomponentsettings.cpp @@ -107,7 +107,7 @@ TimePlotComponentSettings::TimePlotComponentSettings(TimePlotComponent *plt, QWi m_xAxisShow = new MenuOnOffSwitch("XY - Plot X source", plotMenu, false); connect(xySwitch, &QAbstractButton::toggled, this, [=](bool b) { - m_plotComponent->xyPlot()->setVisible(b); + m_plotComponent->xyDockWidget()->setActivated(b); m_xAxisSrc->setVisible(b); m_xAxisShow->setVisible(b); });