-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathmyquickitem.h
44 lines (36 loc) · 1010 Bytes
/
myquickitem.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
#ifndef MYQUICKITEM_H
#define MYQUICKITEM_H
#include <QtQuick/QQuickPaintedItem>
#include <QColor>
/**
* @brief The MyQuickItem class. Simple QQuickItem plugin example;
*/
class MyQuickItem: public QQuickPaintedItem {
Q_OBJECT
Q_PROPERTY(QColor color READ getColor WRITE setColor NOTIFY colorChanged)
public:
MyQuickItem(QQuickItem* parent = nullptr);
/**
* @brief getColor getter for @property color
* @return current color
*/
QColor getColor() const;
/**
* @brief setColor setter for @property color
* @param color color to set
*/
void setColor(const QColor &color);
/**
* @brief paint overrided method that will paint our item on scene
* @param painter painter
*/
void paint(QPainter *painter) override;
signals:
/**
* @brief colorChanged signal that should be emitted when @property color changes
*/
void colorChanged();
private:
QColor color;
};
#endif // MYQUICKITEM_H