Changeset - d1ec2d001aae
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 9 years ago 2017-01-02 15:14:04
hy@ozderya.net
update symbol colors as well
2 files changed with 23 insertions and 16 deletions:
0 comments (0 inline, 0 general)
src/plot.h
Show inline comments
 
@@ -37,28 +37,14 @@ class Plot : public QwtPlot
 
{
 
    Q_OBJECT
 

	
 
    friend class PlotManager;
 

	
 
public:
 
    Plot(QWidget* parent = 0);
 
    ~Plot();
 

	
 
    static QColor makeColor(unsigned int channelIndex);
 

	
 
private:
 
    bool isAutoScaled;
 
    double yMin, yMax;
 
    int symbolSize;
 
    Zoomer zoomer;
 
    ScaleZoomer sZoomer;
 
    QwtPlotGrid grid;
 
    PlotSnapshotOverlay* snapshotOverlay;
 
    QwtPlotLegendItem legend;
 
    QwtPlotTextLabel demoIndicator;
 

	
 
    /// update the display of symbols depending on `symbolSize`
 
    void updateSymbols();
 
    void resetAxes();
 
    void resizeEvent(QResizeEvent * event);
 

	
 
public slots:
 
    void showGrid(bool show = true);
 
    void showMinorGrid(bool show = true);
 
@@ -77,6 +63,24 @@ public slots:
 

	
 
    void onNumOfSamplesChanged(unsigned value);
 

	
 
protected:
 
    /// update the display of symbols depending on `symbolSize`
 
    void updateSymbols();
 

	
 
private:
 
    bool isAutoScaled;
 
    double yMin, yMax;
 
    int symbolSize;
 
    Zoomer zoomer;
 
    ScaleZoomer sZoomer;
 
    QwtPlotGrid grid;
 
    PlotSnapshotOverlay* snapshotOverlay;
 
    QwtPlotLegendItem legend;
 
    QwtPlotTextLabel demoIndicator;
 

	
 
    void resetAxes();
 
    void resizeEvent(QResizeEvent * event);
 

	
 
private slots:
 
    void unzoomed();
 
    void onXScaleChanged();
src/plotmanager.cpp
Show inline comments
 
@@ -18,6 +18,7 @@
 
*/
 

	
 
#include <QtDebug>
 
#include "qwt_symbol.h"
 

	
 
#include "plot.h"
 
#include "plotmanager.h"
 
@@ -133,6 +134,7 @@ void PlotManager::onChannelInfoChanged(c
 
        // replot only updated widgets
 
        if (isMulti)
 
        {
 
            plotWidgets[ci]->updateSymbols(); // required for color change
 
            plotWidgets[ci]->replot();
 
        }
 
    }
 
@@ -140,6 +142,7 @@ void PlotManager::onChannelInfoChanged(c
 
    // replot single widget
 
    if (!isMulti)
 
    {
 
        plotWidgets[0]->updateSymbols();
 
        replot();
 
    }
 
}
0 comments (0 inline, 0 general)