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 QQUICKSTYLEITEMSCROLLBAR_H |
5 | #define QQUICKSTYLEITEMSCROLLBAR_H |
6 | |
7 | #include "qquickstyleitem.h" |
8 | #include <QtQuickTemplates2/private/qquickscrollbar_p.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | class QQuickStyleItemScrollBar : public QQuickStyleItem |
13 | { |
14 | Q_OBJECT |
15 | |
16 | Q_PROPERTY(SubControl subControl MEMBER m_subControl) |
17 | |
18 | QML_NAMED_ELEMENT(ScrollBar) |
19 | |
20 | public: |
21 | enum SubControl { |
22 | Groove = 1, |
23 | Handle, |
24 | AddLine, |
25 | SubLine |
26 | }; |
27 | Q_ENUM(SubControl) |
28 | |
29 | explicit QQuickStyleItemScrollBar(QQuickItem *parent = nullptr); |
30 | |
31 | QFont styleFont(QQuickItem *control) const override; |
32 | |
33 | protected: |
34 | void connectToControl() const override; |
35 | void paintEvent(QPainter *painter) const override; |
36 | StyleItemGeometry calculateGeometry() override; |
37 | |
38 | private: |
39 | void initStyleOption(QStyleOptionSlider &styleOption) const; |
40 | |
41 | private: |
42 | SubControl m_subControl = Groove; |
43 | }; |
44 | |
45 | QT_END_NAMESPACE |
46 | |
47 | #endif // QQUICKSTYLEITEMSCROLLBAR_H |
48 |