Main Page · Class Overview · Hierarchy · All Classes
item-curve.h
1 /***************************************************************************
2 ** **
3 ** QCustomPlot, an easy to use, modern plotting widget for Qt **
4 ** Copyright (C) 2011, 2012, 2013, 2014 Emanuel Eichhammer **
5 ** **
6 ** This program is free software: you can redistribute it and/or modify **
7 ** it under the terms of the GNU General Public License as published by **
8 ** the Free Software Foundation, either version 3 of the License, or **
9 ** (at your option) any later version. **
10 ** **
11 ** This program is distributed in the hope that it will be useful, **
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of **
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
14 ** GNU General Public License for more details. **
15 ** **
16 ** You should have received a copy of the GNU General Public License **
17 ** along with this program. If not, see http://www.gnu.org/licenses/. **
18 ** **
19 ****************************************************************************
20 ** Author: Emanuel Eichhammer **
21 ** Website/Contact: http://www.qcustomplot.com/ **
22 ** Date: 14.03.14 **
23 ** Version: 1.2.0 **
24 ****************************************************************************/
25 
26 #ifndef QCP_ITEM_CURVE_H
27 #define QCP_ITEM_CURVE_H
28 
29 #include "../global.h"
30 #include "../item.h"
31 #include "../lineending.h"
32 
33 class QCPPainter;
34 class QCustomPlot;
35 
36 class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem
37 {
38  Q_OBJECT
40  Q_PROPERTY(QPen pen READ pen WRITE setPen)
41  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
42  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
43  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
45 public:
46  QCPItemCurve(QCustomPlot *parentPlot);
47  virtual ~QCPItemCurve();
48 
49  // getters:
50  QPen pen() const { return mPen; }
51  QPen selectedPen() const { return mSelectedPen; }
52  QCPLineEnding head() const { return mHead; }
53  QCPLineEnding tail() const { return mTail; }
54 
55  // setters;
56  void setPen(const QPen &pen);
57  void setSelectedPen(const QPen &pen);
58  void setHead(const QCPLineEnding &head);
59  void setTail(const QCPLineEnding &tail);
60 
61  // reimplemented virtual methods:
62  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
63 
64  QCPItemPosition * const start;
65  QCPItemPosition * const startDir;
66  QCPItemPosition * const endDir;
67  QCPItemPosition * const end;
68 
69 protected:
70  // property members:
71  QPen mPen, mSelectedPen;
72  QCPLineEnding mHead, mTail;
73 
74  // reimplemented virtual methods:
75  virtual void draw(QCPPainter *painter);
76 
77  // non-virtual methods:
78  QPen mainPen() const;
79 };
80 
81 #endif // QCP_ITEM_CURVE_H