Changeset - 85b902fd5722
[Not reviewed]
barplot
0 1 0
Hasan Yavuz Ă–ZDERYA - 8 years ago 2017-10-07 08:32:10
hy@ozderya.net
fix initial background for barplot
1 file changed with 1 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/plotmanager.cpp
Show inline comments
 
@@ -240,96 +240,97 @@ void PlotManager::setMulti(bool enabled)
 
    {
 
        curve->detach();
 
    }
 

	
 
    // remove all widgets
 
    while (plotWidgets.size())
 
    {
 
        delete plotWidgets.takeLast();
 
    }
 

	
 
    // setup new layout
 
    setupLayout(isMulti);
 

	
 
    if (isMulti)
 
    {
 
        // add new widgets and attach
 
        for (auto curve : curves)
 
        {
 
            auto plot = addPlotWidget();
 
            plot->setVisible(curve->isVisible());
 
            curve->attach(plot);
 
        }
 
    }
 
    else
 
    {
 
        // add a single widget
 
        auto plot = addPlotWidget();
 

	
 
        // attach all curves
 
        for (auto curve : curves)
 
        {
 
            curve->attach(plot);
 
        }
 
    }
 

	
 
    checkNoVisChannels();
 
}
 

	
 
void PlotManager::showBarPlot(bool show)
 
{
 
    // A secondary plot can only be shown if splitter is provided.
 
    Q_ASSERT(_splitter != NULL);
 

	
 
    if (show)
 
    {
 
        Q_ASSERT(barPlot == NULL);
 

	
 
        barPlot = new BarPlot(_channelMan, _splitter);
 
        barPlot->darkBackground(darkBackgroundAction.isChecked());
 
    }
 
    else
 
    {
 
        Q_ASSERT(barPlot != NULL);
 

	
 
        delete barPlot;
 
        barPlot = NULL;
 
    }
 
}
 

	
 
void PlotManager::setupLayout(bool multiPlot)
 
{
 
    // delete previous layout if it exists
 
    if (_plotArea->layout() != 0)
 
    {
 
        delete _plotArea->layout();
 
    }
 

	
 
    if (multiPlot)
 
    {
 
        // setup a scroll area
 
        scrollArea = new QScrollArea();
 
        auto scrolledPlotArea = new QWidget(scrollArea);
 
        scrollArea->setWidget(scrolledPlotArea);
 
        scrollArea->setWidgetResizable(true);
 

	
 
        _plotArea->setLayout(new QVBoxLayout());
 
        _plotArea->layout()->addWidget(scrollArea);
 
        _plotArea->layout()->setContentsMargins(0,0,0,0);
 

	
 
        layout = new QVBoxLayout(scrolledPlotArea);
 
    }
 
    else
 
    {
 
        // delete scrollArea left from multi layout
 
        if (scrollArea != NULL)
 
        {
 
            delete scrollArea;
 
            scrollArea = NULL;
 
        }
 

	
 
        layout = new QVBoxLayout(_plotArea);
 
    }
 

	
 
    layout->setContentsMargins(2,2,2,2);
 
    layout->setSpacing(1);
 
}
 

	
0 comments (0 inline, 0 general)