Changeset - dd4e82b7d5a8
[Not reviewed]
plot-manager
0 3 0
Hasan Yavuz Ă–ZDERYA - 9 years ago 2016-08-25 01:06:36
hy@ozderya.net
implemented plotman.settitle
3 files changed with 23 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/mainwindow.cpp
Show inline comments
 
@@ -331,10 +331,9 @@ void MainWindow::onChannelNameChanged(un
 
    // This slot is triggered also when a new channel is added, in
 
    // this case curve list doesn't contain said channel. No worries,
 
    // since `onNumOfChannelsChanged` slot will update curve list.
 
    if ((int) channel < curves.size()) // check if channel exists in curve list
 
    if (channel < plotMan->numOfCurves()) // check if channel exists in curve list
 
    {
 
        curves[channel]->setTitle(name);
 
        ui->plot->replot();
 
        plotMan->setTitle(channel, name);
 
    }
 
}
 

	
src/plotmanager.cpp
Show inline comments
 
@@ -185,3 +185,22 @@ unsigned PlotManager::numOfCurves()
 
{
 
    return curves.size();
 
}
 

	
 
void PlotManager::setTitle(unsigned index, QString title)
 
{
 
    curves[index]->setTitle(title);
 

	
 
    plotWidget(index)->replot();
 
}
 

	
 
Plot* PlotManager::plotWidget(unsigned curveIndex)
 
{
 
    if (isMulti)
 
    {
 
        return plotWidgets[curveIndex];
 
    }
 
    else
 
    {
 
        return plotWidgets[0];
 
    }
 
}
src/plotmanager.h
Show inline comments
 
@@ -67,6 +67,8 @@ private:
 

	
 
    void setupLayout(bool multiPlot);
 
    Plot* addPlotWidget(); ///< inserts a new plot widget to the current layout
 
    /// Returns the plot widget that given curve is attached to
 
    Plot* plotWidget(unsigned curveIndex);
 
};
 

	
 
#endif // PLOTMANAGER_H
0 comments (0 inline, 0 general)