DtkDeclarative
DTK Declarative module
载入中...
搜索中...
未找到
dquickarrowboxpath_p.h
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DQUICKARROWBOXPATH_H
6#define DQUICKARROWBOXPATH_H
7
8#include <dtkdeclarative_global.h>
9#include <private/dqmlglobalobject_p.h>
10
11#include <private/qquickpath_p.h>
12
13DQUICK_BEGIN_NAMESPACE
14
15class DQuickArrowBoxPath : public QQuickCurve
16{
17 Q_OBJECT
18 Q_PROPERTY(Direction arrowDirection READ arrowDirection WRITE setArrowDirection NOTIFY arrowDirectionChanged)
19 Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged)
20 Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged)
21 Q_PROPERTY(qreal arrowX READ arrowX WRITE setArrowX NOTIFY arrowXChanged)
22 Q_PROPERTY(qreal arrowY READ arrowY WRITE setArrowY NOTIFY arrowYChanged)
23 Q_PROPERTY(qreal arrowWidth READ arrowWidth WRITE setArrowWidth NOTIFY arrowWidthChanged)
24 Q_PROPERTY(qreal arrowHeight READ arrowHeight WRITE setArrowHeight NOTIFY arrowHeightChanged)
25 Q_PROPERTY(qreal roundedRadius READ roundedRadius WRITE setRoundedRadius NOTIFY roundedRadiusChanged)
26 Q_PROPERTY(qreal spread READ spread WRITE setSpread NOTIFY spreadChanged)
27#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
28 QML_NAMED_ELEMENT(ArrowBoxPath)
29#endif
30
31public:
32 enum Direction {
33 Up,
34 Down,
35 Left,
36 Right
37 };
38 Q_ENUM(Direction)
39
40 explicit DQuickArrowBoxPath(QObject *parent = nullptr);
41
42 qreal width() const;
43 void setWidth(qreal newWidth);
44
45 qreal height() const;
46 void setHeight(qreal newHeight);
47
48 const Direction &arrowDirection() const;
49 void setArrowDirection(const Direction &newArrowDirection);
50
51 qreal arrowX() const;
52 void setArrowX(qreal newArrowX);
53
54 qreal arrowY() const;
55 void setArrowY(qreal newArrowY);
56
57 qreal arrowWidth() const;
58 void setArrowWidth(qreal newArrowWidth);
59
60 qreal arrowHeight() const;
61 void setArrowHeight(qreal newArrowHeight);
62
63 qreal roundedRadius() const;
64 void setRoundedRadius(qreal newRoundedRadius);
65
66 qreal spread() const;
67 void setSpread(qreal newSpread);
68
69Q_SIGNALS:
70 void widthChanged();
71 void heightChanged();
72 void arrowDirectionChanged();
73 void arrowXChanged();
74 void arrowYChanged();
75 void arrowWidthChanged();
76 void arrowHeightChanged();
77 void roundedRadiusChanged();
78
79 void spreadChanged();
80
81private:
82 void addToPath(QPainterPath &path, const QQuickPathData &) override;
83
84 Direction m_arrowDirection;
85 qreal m_width;
86 qreal m_height;
87 qreal m_arrowX;
88 qreal m_arrowY;
89 qreal m_arrowWidth;
90 qreal m_arrowHeight;
91 qreal m_roundedRadius;
92 qreal m_spread;
93};
94
95DQUICK_END_NAMESPACE
96
97#endif // DQUICKARROWBOXPATH_H
Definition dquickarrowboxpath_p.h:16