QtPdWidgets  2.3.1
XYGraph.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2009 Florian Pose <fp@igh-essen.com>
4  *
5  * This file is part of the QtPdWidgets library.
6  *
7  * The QtPdWidgets library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, either version 3 of the License,
10  * or (at your option) any later version.
11  *
12  * The QtPdWidgets library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the QtPdWidgets Library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  ****************************************************************************/
22 
23 #ifndef PD_XYGRAPH_H
24 #define PD_XYGRAPH_H
25 
26 #include "Export.h"
27 #include <QtPdCom1/Transmission.h>
28 
29 #include <pdcom5/Variable.h>
30 #include <pdcom5/Process.h>
31 #include <pdcom5/Subscription.h>
32 
33 #include <QFrame>
34 
35 #include <memory>
36 
37 namespace Pd {
38 
39 /****************************************************************************/
40 
44  public QFrame
45 {
46  Q_OBJECT
48  Q_PROPERTY(double timeRange
49  READ getTimeRange WRITE setTimeRange RESET resetTimeRange)
51  Q_PROPERTY(double scaleXMin
52  READ getScaleXMin WRITE setScaleXMin RESET resetScaleXMin)
54  Q_PROPERTY(double scaleXMax
55  READ getScaleXMax WRITE setScaleXMax RESET resetScaleXMax)
57  Q_PROPERTY(double scaleYMin
58  READ getScaleYMin WRITE setScaleYMin RESET resetScaleYMin)
60  Q_PROPERTY(double scaleYMax
61  READ getScaleYMax WRITE setScaleYMax RESET resetScaleYMax)
63  Q_PROPERTY(int lineWidth
64  READ getLineWidth WRITE setLineWidth RESET resetLineWidth)
66  Q_PROPERTY(QColor lineColor
67  READ getLineColor WRITE setLineColor
68  RESET resetLineColor)
69 
70  public:
71  XYGraph(QWidget *parent = 0);
72  virtual ~XYGraph();
73 
74  void addVariable(PdCom::Variable, const PdCom::Selector & = {},
75  const QtPdCom::Transmission & = QtPdCom::event_mode, double = 1.0,
76  double = 0.0);
77  void addVariable(PdCom::Process *, const QString &,
78  const PdCom::Selector & = {},
79  const QtPdCom::Transmission & = QtPdCom::event_mode, double = 1.0,
80  double = 0.0);
81  void clearVariables();
82  void clearData();
83 
84  double getTimeRange() const;
85  void setTimeRange(double);
86  void resetTimeRange();
87  double getScaleXMin() const;
88  void setScaleXMin(double);
89  void resetScaleXMin();
90  double getScaleXMax() const;
91  void setScaleXMax(double);
92  void resetScaleXMax();
93  double getScaleYMin() const;
94  void setScaleYMin(double);
95  void resetScaleYMin();
96  double getScaleYMax() const;
97  void setScaleYMax(double);
98  void resetScaleYMax();
99  int getLineWidth() const;
100  void setLineWidth(int);
101  void resetLineWidth();
102  QColor getLineColor() const;
103  void setLineColor(const QColor &);
104  void resetLineColor();
105 
106  virtual QSize sizeHint() const;
107 
108  protected:
109  bool event(QEvent *);
110  void resizeEvent(QResizeEvent *);
111  void paintEvent(QPaintEvent *);
112 
113  private:
114  struct PD_PRIVATE Impl;
115  std::unique_ptr<Impl> impl;
116 };
117 
118 /****************************************************************************/
119 
120 } // namespace
121 
122 #endif
Definition: Bar.h:36
#define PD_PRIVATE
Definition: Export.h:28
Definition: XYGraph.cpp:53
#define PD_PUBLIC
Definition: Export.h:33
XY Graph.
Definition: XYGraph.h:43
std::unique_ptr< Impl > impl
Definition: XYGraph.h:115