customshape.h
Go to the documentation of this file.
1 #ifndef CUSTOMSHAPE_H
2 #define CUSTOMSHAPE_H
3 
4 #include <QQuickItem>
5 
6 namespace dnai
7 {
8  namespace views
9  {
10  class CustomShape : public QQuickItem
11  {
12  Q_OBJECT
13 
14  public:
15  Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
16  Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
17  Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged)
18  Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
19 
20  public:
21  explicit CustomShape(QQuickItem *parent = nullptr);
22  virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
23 
24  public:
25  qreal radius() const { return m_radius; }
26  qreal borderWidth() const { return m_borderWidth; }
27  const QColor &fillColor() const { return m_fillColor; }
28  const QColor &borderColor() const { return m_borderColor; }
29 
30  public:
31  void setRadius(qreal radius);
32  virtual void setBorderWidth(qreal w);
33  virtual void setFillColor(const QColor &color);
34  virtual void setBorderColor(const QColor &color);
35 
36  void resetRadius();
37  void resetBorderWidth();
38  void resetBorderColor();
39  void resetFillColor();
40  void resetPos();
41  void resetShape();
42 
43  signals:
44  void radiusChanged(qreal radius);
45  void borderWidthChanged(qreal w);
46  void fillColorChanged(const QColor &color);
47  void borderColorChanged(const QColor &color);
48 
49 
50  protected:
51  qreal m_radius;
53  QColor m_fillColor;
54  QColor m_borderColor;
55 
56  qreal m_saveRadius;
60  QPointF m_savePos;
61  };
62  }
63 }
64 
65 #endif // CUSTOMSHAPE_H
const QColor & fillColor() const
Definition: customshape.h:27
void radiusChanged(qreal radius)
Definition: moc_customshape.cpp:220
Definition: customshape.h:10
const QColor & borderColor() const
Definition: customshape.h:28
void resetBorderColor()
Definition: customshape.cpp:69
QColor m_saveFillColor
Definition: customshape.h:58
QColor m_fillColor
Definition: customshape.h:53
void resetPos()
Definition: customshape.cpp:78
virtual void setBorderWidth(qreal w)
Definition: customshape.cpp:32
qreal m_radius
Definition: customshape.h:51
void resetRadius()
Definition: customshape.cpp:59
qreal m_borderWidth
Definition: customshape.h:52
void setRadius(qreal radius)
Definition: customshape.cpp:22
virtual QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *) override
Definition: customshape.cpp:92
QColor m_saveBorderColor
Definition: customshape.h:59
void fillColorChanged(const QColor &color)
Definition: moc_customshape.cpp:234
void resetBorderWidth()
Definition: customshape.cpp:64
QPointF m_savePos
Definition: customshape.h:60
Definition: api.h:13
void resetShape()
Definition: customshape.cpp:83
qreal radius() const
Definition: customshape.h:25
void borderWidthChanged(qreal w)
Definition: moc_customshape.cpp:227
virtual void setFillColor(const QColor &color)
Definition: customshape.cpp:41
void borderColorChanged(const QColor &color)
Definition: moc_customshape.cpp:241
qreal m_saveRadius
Definition: customshape.h:56
qreal borderWidth() const
Definition: customshape.h:26
QColor m_borderColor
Definition: customshape.h:54
qreal m_saveBorderWidth
Definition: customshape.h:57
void resetFillColor()
Definition: customshape.cpp:73
virtual void setBorderColor(const QColor &color)
Definition: customshape.cpp:50