2024-08-20 23:58:02 +08:00
|
|
|
#ifndef RECTANGLE_H
|
|
|
|
#define RECTANGLE_H
|
|
|
|
|
|
|
|
#include <QQuickPaintedItem>
|
|
|
|
|
|
|
|
class Rectangle : public QQuickPaintedItem {
|
|
|
|
Q_OBJECT
|
|
|
|
QML_ELEMENT
|
2024-08-21 23:26:43 +08:00
|
|
|
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
|
|
|
|
Q_PROPERTY(QList<int> radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
2024-08-20 23:58:02 +08:00
|
|
|
|
2024-08-21 23:26:43 +08:00
|
|
|
public:
|
|
|
|
Rectangle(QQuickItem *parent = nullptr);
|
2024-08-20 23:58:02 +08:00
|
|
|
void paint(QPainter *painter) final;
|
|
|
|
|
2024-08-21 23:26:43 +08:00
|
|
|
QColor color() const;
|
|
|
|
void setColor(const QColor &color);
|
|
|
|
|
|
|
|
QList<int> radius() const;
|
|
|
|
void setRadius(const QList<int> &radius);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void colorChanged();
|
|
|
|
void radiusChanged();
|
|
|
|
|
2024-08-20 23:58:02 +08:00
|
|
|
private:
|
|
|
|
QColor m_color;
|
|
|
|
QList<int> m_radius;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RECTANGLE_H
|