File: plot.h

package info (click to toggle)
qspeakers 1.8.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 900 kB
  • sloc: cpp: 4,593; xml: 708; sh: 13; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef PLOT_H
#define PLOT_H

#include <QtCharts/QtCharts>

class Plot : public QChartView
{
    Q_OBJECT

public:
    Plot(QWidget *parent = 0);
    Plot(QString title, QWidget *parent = 0);
    ~Plot();
    void appendPointF(const QPointF& pointf);
    void plot(const QList<double> x, QList<double>y);
    void clear(void);
    void setUseOpenGL(bool enable = true);

    void draw3dbVLine();
    double getXmin() const;
    double getXmax() const;
    QLineSeries* series() const;

protected:
    void initializeScales();
    void initializeChart(const QString& title = nullptr);
    void initializeCurve();
    void resizeEvent(QResizeEvent *event);
    bool viewportEvent(QEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent* event);
    void mouseReleaseEvent(QMouseEvent* event);
    double curveXfromY(double y);
    double curveYfromX(double x);
    void drawVLine(QPoint pos);
private:
    QLineSeries *curve;
    QChart *chart;
    double xmin;
    double xmax;
    QGraphicsSimpleTextItem *pointerLabel;
    QGraphicsLineItem *vLine;
    QGraphicsLineItem *vLine3db;
    QGraphicsSimpleTextItem *vLabel3db;
};

#endif // PLOT_H