diff --git a/gui/include/gui/mapstackedwidget.h b/gui/include/gui/mapstackedwidget.h index 27c7ce915f..00608bb647 100644 --- a/gui/include/gui/mapstackedwidget.h +++ b/gui/include/gui/mapstackedwidget.h @@ -19,6 +19,10 @@ class SCOPY_GUI_EXPORT MapStackedWidget : public QStackedWidget virtual QString getKey(QWidget *w); virtual bool contains(QString key); virtual QWidget *get(QString key); + + QSize sizeHint() const override; + QSize minimumSizeHint() const override; + public Q_SLOTS: virtual bool show(QString key); diff --git a/gui/src/mapstackedwidget.cpp b/gui/src/mapstackedwidget.cpp index d6340fc273..701557fbe4 100644 --- a/gui/src/mapstackedwidget.cpp +++ b/gui/src/mapstackedwidget.cpp @@ -50,6 +50,22 @@ QWidget *MapStackedWidget::get(QString key) return nullptr; } +QSize MapStackedWidget::sizeHint() const +{ + if(currentWidget()) { + return currentWidget()->sizeHint(); + } + return QStackedWidget::sizeHint(); +} + +QSize MapStackedWidget::minimumSizeHint() const +{ + if(currentWidget()) { + return currentWidget()->minimumSizeHint(); + } + return QStackedWidget::minimumSizeHint(); +} + bool MapStackedWidget::show(QString key) { QWidget *w = map[key]; diff --git a/plugins/adc/src/time/timeplotcomponentsettings.cpp b/plugins/adc/src/time/timeplotcomponentsettings.cpp index 3079a2b74e..098dce6bac 100644 --- a/plugins/adc/src/time/timeplotcomponentsettings.cpp +++ b/plugins/adc/src/time/timeplotcomponentsettings.cpp @@ -162,6 +162,12 @@ TimePlotComponentSettings::TimePlotComponentSettings(TimePlotComponent *plt, QWi } void TimePlotComponentSettings::showDeleteButtons(bool b) +{ + m_deletePlotHover->setVisible(b); + m_deletePlot->setVisible(b); +} + +void TimePlotComponentSettings::showPlotButtons(bool b) { m_plotComponent->timePlot()->plotButtonManager()->setVisible(b); m_deletePlot->setVisible(b); diff --git a/plugins/adc/src/time/timeplotcomponentsettings.h b/plugins/adc/src/time/timeplotcomponentsettings.h index a0eb13e6e5..b4b9fe4967 100644 --- a/plugins/adc/src/time/timeplotcomponentsettings.h +++ b/plugins/adc/src/time/timeplotcomponentsettings.h @@ -19,6 +19,7 @@ class SCOPY_ADC_EXPORT TimePlotComponentSettings : public QWidget, public ToolCo ~TimePlotComponentSettings(); void showDeleteButtons(bool b); + void showPlotButtons(bool b); public Q_SLOTS: void addChannel(ChannelComponent *c); diff --git a/plugins/adc/src/time/timeplotmanager.cpp b/plugins/adc/src/time/timeplotmanager.cpp index c6fd0f011b..77f977c3cf 100644 --- a/plugins/adc/src/time/timeplotmanager.cpp +++ b/plugins/adc/src/time/timeplotmanager.cpp @@ -86,7 +86,10 @@ void TimePlotManager::multiPlotUpdate() for(PlotComponent *p : qAsConst(m_plots)) { auto plt = dynamic_cast(p); - plt->plotMenu()->showDeleteButtons(b); + plt->plotMenu()->showPlotButtons(b); + + // do not allow users to delete the primary plot + plt->plotMenu()->showDeleteButtons(b && plt != m_primary); } for(PlotManagerCombobox *cb : m_channelPlotcomboMap) {