Changeset - baaf95cd2089
[Not reviewed]
plot-manager
0 4 0
Hasan Yavuz Ă–ZDERYA - 9 years ago 2016-08-26 16:02:16
hy@ozderya.net
enabled legend menu item
4 files changed with 22 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/plot.cpp
Show inline comments
 
@@ -98,6 +98,12 @@ void Plot::showMinorGrid(bool show)
 
    replot();
 
}
 

	
 
void Plot::showLegend(bool show)
 
{
 
    legend.setVisible(show);
 
    replot();
 
}
 

	
 
void Plot::unzoom()
 
{
 
    zoomer.zoom(0);
src/plot.h
Show inline comments
 
@@ -56,6 +56,7 @@ private:
 
public slots:
 
    void showGrid(bool show = true);
 
    void showMinorGrid(bool show = true);
 
    void showLegend(bool show = true);
 
    void unzoom();
 
    void darkBackground(bool enabled = true);
 
    void setAxis(bool autoScaled, double yMin = 0, double yMax = 1);
src/plotmanager.cpp
Show inline comments
 
@@ -70,9 +70,8 @@ PlotManager::PlotManager(QWidget* plotAr
 
    connect(&unzoomAction, &QAction::triggered, this, &PlotManager::unzoom);
 
    connect(&darkBackgroundAction, SELECT<bool>::OVERLOAD_OF(&QAction::triggered),
 
            this, &PlotManager::darkBackground);
 
    // TODO: enable legend
 
    // connect(&showLegendAction, SELECT<bool>::OVERLOAD_OF(&QAction::triggered),
 
    //         [this](bool enabled){legend.setVisible(enabled); replot();});
 
    connect(&showLegendAction, SELECT<bool>::OVERLOAD_OF(&QAction::triggered),
 
            this, &PlotManager::showLegend);
 
}
 

	
 
PlotManager::~PlotManager()
 
@@ -174,7 +173,7 @@ Plot* PlotManager::addPlotWidget()
 
    plot->darkBackground(darkBackgroundAction.isChecked());
 
    plot->showGrid(showGridAction.isChecked());
 
    plot->showMinorGrid(showMinorGridAction.isChecked());
 
    // TODO: show legend
 
    plot->showLegend(showLegendAction.isChecked());
 

	
 
    return plot;
 
}
 
@@ -270,6 +269,7 @@ void PlotManager::showGrid(bool show)
 
        plot->showGrid(show);
 
    }
 
}
 

	
 
void PlotManager::showMinorGrid(bool show)
 
{
 
    for (auto plot : plotWidgets)
 
@@ -277,6 +277,15 @@ void PlotManager::showMinorGrid(bool sho
 
        plot->showMinorGrid(show);
 
    }
 
}
 

	
 
void PlotManager::showLegend(bool show)
 
{
 
    for (auto plot : plotWidgets)
 
    {
 
        plot->showLegend(show);
 
    }
 
}
 

	
 
void PlotManager::unzoom()
 
{
 
    for (auto plot : plotWidgets)
 
@@ -284,6 +293,7 @@ void PlotManager::unzoom()
 
        plot->unzoom();
 
    }
 
}
 

	
 
void PlotManager::darkBackground(bool enabled)
 
{
 
    for (auto plot : plotWidgets)
src/plotmanager.h
Show inline comments
 
@@ -83,6 +83,7 @@ private:
 
private slots:
 
    void showGrid(bool show = true);
 
    void showMinorGrid(bool show = true);
 
    void showLegend(bool show = true);
 
    void unzoom();
 
    void darkBackground(bool enabled = true);
 
};
0 comments (0 inline, 0 general)