-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrectelement.h
45 lines (35 loc) · 1004 Bytes
/
rectelement.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
38
39
40
41
42
43
44
45
#ifndef RECTELEMENT_H
#define RECTELEMENT_H
#include <QPen>
#include "baseelement.h"
class RectElement : public BaseElement
{
Q_OBJECT
Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
QPen m_pen;
enum { Type = QGraphicsItem::UserType + GRAPHICSITEM_TYPE_RECT };
int type() const override
{
// Enable the use of qgraphicsitem_cast with this item.
return Type;
}
public:
RectElement(
BaseElement *parent,
BaseSpace * space,
QRectF initRect = QRectF(0,0,100,100)
);
QPen pen() const
{
return m_pen;
}
QPainterPath shape() const override;
public slots:
void setPen(const QPen & pen);
signals:
void penChanged(QPen pen);
protected:
BasePicker *createPicker() Q_DECL_OVERRIDE;
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget *widget=nullptr) override;
};
#endif // RECTELEMENT_H