diff --git a/src/plotmanager.cpp b/src/plotmanager.cpp --- a/src/plotmanager.cpp +++ b/src/plotmanager.cpp @@ -17,6 +17,7 @@ along with serialplot. If not, see . */ +#include #include #include #include @@ -46,6 +47,7 @@ PlotManager::PlotManager(QWidget* plotAr _infoModel = infoModel; _numOfSamples = 1; showSymbols = Plot::ShowSymbolsAuto; + emptyPlot = NULL; // initalize layout and single widget isMulti = false; @@ -156,6 +158,7 @@ PlotManager::~PlotManager() } if (scrollArea != NULL) delete scrollArea; + if (emptyPlot != NULL) delete emptyPlot; } void PlotManager::onChannelInfoChanged(const QModelIndex &topLeft, @@ -189,6 +192,8 @@ void PlotManager::onChannelInfoChanged(c } } + checkNoVisChannels(); + // replot single widget if (!isMulti) { @@ -198,6 +203,20 @@ void PlotManager::onChannelInfoChanged(c } } +void PlotManager::checkNoVisChannels() +{ + // if all channels are hidden show indicator + bool allhidden = std::none_of(curves.cbegin(), curves.cend(), + [](QwtPlotCurve* c) {return c->isVisible();}); + + plotWidgets[0]->showNoChannel(allhidden); + if (isMulti) + { + plotWidgets[0]->showNoChannel(allhidden); + plotWidgets[0]->setVisible(true); + } +} + void PlotManager::setMulti(bool enabled) { if (enabled == isMulti) return; @@ -240,6 +259,8 @@ void PlotManager::setMulti(bool enabled) curve->attach(plot); } } + + checkNoVisChannels(); } void PlotManager::setupLayout(bool multiPlot)