| 1 | // Copyright (C) 2020 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 QQUICKSTYLEITEMSPINBOX_H |
| 5 | #define QQUICKSTYLEITEMSPINBOX_H |
| 6 | |
| 7 | #include "qquickstyleitem.h" |
| 8 | #include <QtQuickTemplates2/private/qquickspinbox_p.h> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | class QQuickStyleItemSpinBox : public QQuickStyleItem |
| 13 | { |
| 14 | Q_OBJECT |
| 15 | |
| 16 | Q_PROPERTY(SubControl subControl MEMBER m_subControl) |
| 17 | |
| 18 | QML_NAMED_ELEMENT(SpinBox) |
| 19 | |
| 20 | public: |
| 21 | enum SubControl { |
| 22 | Frame = 1, |
| 23 | Up, |
| 24 | Down, |
| 25 | }; |
| 26 | Q_ENUM(SubControl) |
| 27 | |
| 28 | QFont styleFont(QQuickItem *control) const override; |
| 29 | |
| 30 | protected: |
| 31 | void connectToControl() const override; |
| 32 | void paintEvent(QPainter *painter) const override; |
| 33 | StyleItemGeometry calculateGeometry() override; |
| 34 | |
| 35 | private: |
| 36 | void initStyleOption(QStyleOptionSpinBox &styleOption) const; |
| 37 | |
| 38 | private: |
| 39 | SubControl m_subControl = Frame; |
| 40 | }; |
| 41 | |
| 42 | QT_END_NAMESPACE |
| 43 | |
| 44 | #endif // QQUICKSTYLEITEMSPINBOX_H |
| 45 |
