comparison widgets/Plotter.h @ 211:fbd4905ada5e

add plotter
author benoitrigolleau
date Fri, 01 Feb 2008 15:46:16 +0000
parents
children 7d5d51145b81
comparison
equal deleted inserted replaced
210:bf1d6386eb4b 211:fbd4905ada5e
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /* Sound Access
4 EASAIER client application.
5 Silogic 2007. Benoit Rigolleau.
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version. See the file
11 COPYING included with this distribution for more information.
12 */
13
14
15 #ifndef PLOTTER_H
16 #define PLOTTER_H
17
18 #include <QMap>
19 #include <QPixmap>
20 #include <QVector>
21 #include <QWidget>
22
23
24 class Plotter : public QWidget
25 {
26 Q_OBJECT
27
28 public:
29 Plotter(QWidget *parent = 0);
30
31 void setCurveData(const QVector<QPoint> &data);
32 void clearCurve();
33 void setSignalSize(int m_signalWidth, int m_signalHeight);
34 void setMargin(int margin);
35
36 protected:
37 void paintEvent(QPaintEvent *event);
38 void resizeEvent(QResizeEvent *event);
39 void mousePressEvent(QMouseEvent *event);
40 void mouseMoveEvent(QMouseEvent *event);
41 void mouseReleaseEvent(QMouseEvent *event);
42
43 private:
44 void refreshPixmap();
45 void drawGrid(QPainter *painter);
46 void drawCurve(QPainter *painter);
47 void drawMaskCurve(QPainter *painter);
48 QVector<QPoint> m_curve;
49 int *m_curveMask;
50 QPixmap m_pixmap;
51 int m_signalHeight;
52 int m_signalWidth;
53 int m_margin;
54 bool m_curveMaskActive;
55 QPoint m_lastPoint;
56 };
57
58
59 #endif
60