1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKPADDEDRECTANGLE_P_H
5#define QQUICKPADDEDRECTANGLE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick/private/qquickrectangle_p.h>
19#include <QtQuickControls2Impl/private/qtquickcontrols2implglobal_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class Q_QUICKCONTROLS2IMPL_PRIVATE_EXPORT QQuickPaddedRectangle : public QQuickRectangle
24{
25 Q_OBJECT
26 Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
27 Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL)
28 Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL)
29 Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
30 Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
31 QML_NAMED_ELEMENT(PaddedRectangle)
32 QML_ADDED_IN_VERSION(2, 0)
33
34public:
35 QQuickPaddedRectangle(QQuickItem *parent = nullptr);
36
37 qreal padding() const;
38 void setPadding(qreal padding);
39 void resetPadding();
40
41 qreal topPadding() const;
42 void setTopPadding(qreal padding);
43 void resetTopPadding();
44
45 qreal leftPadding() const;
46 void setLeftPadding(qreal padding);
47 void resetLeftPadding();
48
49 qreal rightPadding() const;
50 void setRightPadding(qreal padding);
51 void resetRightPadding();
52
53 qreal bottomPadding() const;
54 void setBottomPadding(qreal padding);
55 void resetBottomPadding();
56
57Q_SIGNALS:
58 void paddingChanged();
59 void topPaddingChanged();
60 void leftPaddingChanged();
61 void rightPaddingChanged();
62 void bottomPaddingChanged();
63
64protected:
65 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
66
67private:
68 void setTopPadding(qreal padding, bool has);
69 void setLeftPadding(qreal padding, bool has);
70 void setRightPadding(qreal padding, bool has);
71 void setBottomPadding(qreal padding, bool has);
72
73 qreal m_padding = 0;
74 qreal m_topPadding = 0;
75 qreal m_leftPadding = 0;
76 qreal m_rightPadding = 0;
77 qreal m_bottomPadding = 0;
78 bool m_hasTopPadding = false;
79 bool m_hasLeftPadding = false;
80 bool m_hasRightPadding = false;
81 bool m_hasBottomPadding = false;
82};
83
84QT_END_NAMESPACE
85
86QML_DECLARE_TYPE(QQuickPaddedRectangle)
87
88#endif // QQUICKPADDEDRECTANGLE_P_H
89

source code of qtdeclarative/src/quickcontrolsimpl/qquickpaddedrectangle_p.h