roundedrectangle.h
Go to the documentation of this file.
1 #ifndef ROUNDEDRECTANGLE_H
2 #define ROUNDEDRECTANGLE_H
3 
4 #include <QtQuick/qsgnode.h>
5 #include "customshape.h"
6 
7 namespace dnai
8 {
9  namespace views
10  {
12  {
13  Q_OBJECT
14 
15  Q_PROPERTY(bool topLeft READ topLeft WRITE setTopLeft NOTIFY topLeftChanged)
16  Q_PROPERTY(bool topRight READ topRight WRITE setTopRight NOTIFY topRightChanged)
17  Q_PROPERTY(bool bottomLeft READ bottomLeft WRITE setBottomLeft NOTIFY bottomLeftChanged)
18  Q_PROPERTY(bool bottomRight READ bottomRight WRITE setBottomRight NOTIFY bottomRightChanged)
19 
21 
22  public:
23  RoundedRectangle(QQuickItem *parent = nullptr);
24 
29  virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
30 
31  public:
32  bool topLeft() const { return m_topLeft; }
33  bool topRight() const { return m_topRight; }
34  bool bottomLeft() const { return m_bottomLeft; }
35  bool bottomRight() const { return m_bottomRight; }
36 
37  int roundedSegments() const { return m_nbSegments; }
38 
39  public:
40  void setTopLeft(bool value);
41  void setTopRight(bool value);
42  void setBottomLeft(bool value);
43  void setBottomRight(bool value);
44 
45  void setRoundedSegments(uint segments);
46 
47  signals:
48  void topLeftChanged(bool value);
49  void topRightChanged(bool value);
50  void bottomLeftChanged(bool value);
51  void bottomRightChanged(bool value);
52 
53  void roundedSegmentsChanged(uint segments);
54 
55  private:
56  bool m_topLeft;
57  bool m_topRight;
60 
62 
63  private:
68  int getNumberRoundedCorner() const;
69 
70  };
71  }
72 }
73 
74 
75 #endif // ROUNDEDRECTANGLE_H
virtual QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *) override
Override updatePaintNode and draw a magnificient rounded rectangle.
Definition: roundedrectangle.cpp:81
Definition: customshape.h:10
void topLeftChanged(bool value)
Definition: moc_roundedrectangle.cpp:238
void setBottomRight(bool value)
Definition: roundedrectangle.cpp:49
uint m_nbSegments
Definition: roundedrectangle.h:61
void setTopLeft(bool value)
Definition: roundedrectangle.cpp:22
int getNumberRoundedCorner() const
return the number of rounded corner
Definition: roundedrectangle.cpp:67
void setBottomLeft(bool value)
Definition: roundedrectangle.cpp:40
void topRightChanged(bool value)
Definition: moc_roundedrectangle.cpp:245
bool m_topRight
Definition: roundedrectangle.h:57
bool m_topLeft
Definition: roundedrectangle.h:56
int roundedSegments() const
Definition: roundedrectangle.h:37
Definition: roundedrectangle.h:11
bool topLeft() const
Definition: roundedrectangle.h:32
void setRoundedSegments(uint segments)
Definition: roundedrectangle.cpp:58
Definition: api.h:13
bool m_bottomRight
Definition: roundedrectangle.h:59
bool topRight() const
Definition: roundedrectangle.h:33
void bottomLeftChanged(bool value)
Definition: moc_roundedrectangle.cpp:252
bool bottomRight() const
Definition: roundedrectangle.h:35
void roundedSegmentsChanged(uint segments)
Definition: moc_roundedrectangle.cpp:266
void setTopRight(bool value)
Definition: roundedrectangle.cpp:31
bool bottomLeft() const
Definition: roundedrectangle.h:34
void bottomRightChanged(bool value)
Definition: moc_roundedrectangle.cpp:259
bool m_bottomLeft
Definition: roundedrectangle.h:58