-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsplineitem.h
37 lines (31 loc) · 993 Bytes
/
splineitem.h
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
/*
* Graphic realization of a spline
* copyright (c) Evgenii Lezhnin <[email protected]>, 2014
*/
#ifndef SPLINEITEM_H
#define SPLINEITEM_H
#include <QGraphicsItem>
class SplineItem : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
explicit SplineItem(const QList<QGraphicsItem*>&,QGraphicsItem *parent = 0); //find a bounding rect, also form the list of point items, and finally find all spline points
int type() const {
// Enable the use of qgraphicsitem_cast with this item.
return Type;
}
protected:
QRectF boundingRect() const;
void paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *); //draw splines and straight lines, which connects points
private:
void find_splines(); //find spline points (point_lists_)
signals:
public slots:
private:
QList<QGraphicsItem*> item_list_;
QList<QList<QPointF> > point_lists_;
QRectF boundingRect_;
public:
enum { Type = UserType + 2 };
};
#endif // SPLINEITEM_H