3#include "qml_material/control/scroll_indicator.hpp"
7class ScrollBarAttached;
10class QML_MATERIAL_API ScrollBar :
public ScrollIndicator {
12 QML_NAMED_ELEMENT(ScrollBarBase)
13 QML_ATTACHED(ScrollBarAttached)
14 Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
15 Q_PROPERTY(
bool pressed READ pressed WRITE setPressed NOTIFY pressedChanged FINAL)
16 Q_PROPERTY(
bool interactive READ interactive WRITE setInteractive RESET resetInteractive NOTIFY
17 interactiveChanged FINAL)
18 Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
19 Q_PROPERTY(Policy policy READ policy WRITE setPolicy NOTIFY policyChanged FINAL)
30 AsNeeded = Qt::ScrollBarAsNeeded,
31 AlwaysOff = Qt::ScrollBarAlwaysOff,
32 AlwaysOn = Qt::ScrollBarAlwaysOn
35 explicit ScrollBar(QQuickItem* parent =
nullptr);
36 ~ScrollBar()
override;
37 static ScrollBarAttached* qmlAttachedProperties(QObject*);
38 qreal stepSize()
const {
return m_step; }
39 bool pressed()
const {
return m_pressed; }
40 bool interactive()
const {
return m_interactive; }
41 SnapMode snapMode()
const {
return m_snap; }
42 Policy policy()
const {
return m_policy; }
43 void setStepSize(qreal);
44 void setPressed(
bool);
45 void setInteractive(
bool);
46 void resetInteractive();
47 void setSnapMode(SnapMode);
48 void setPolicy(Policy);
49 Q_INVOKABLE
void increase();
50 Q_INVOKABLE
void decrease();
51 Q_SIGNAL
void stepSizeChanged();
52 Q_SIGNAL
void pressedChanged();
53 Q_SIGNAL
void interactiveChanged();
54 Q_SIGNAL
void snapModeChanged();
55 Q_SIGNAL
void policyChanged();
58 void setMoving(
bool)
override;
59 void disconnectFlickable()
override;
60 void mousePressEvent(QMouseEvent*)
override;
61 void mouseMoveEvent(QMouseEvent*)
override;
62 void mouseReleaseEvent(QMouseEvent*)
override;
63 void mouseUngrabEvent()
override;
64 void touchEvent(QTouchEvent*)
override;
65 void touchUngrabEvent()
override;
66 void itemChange(ItemChange,
const ItemChangeData&)
override;
71 void begin(
const QPointF&);
72 void move(
const QPointF&,
bool release);
74 qreal logicalPosition(qreal)
const;
75 qreal positionAt(
const QPointF&)
const;
79 bool m_pressed =
false;
80 bool m_interactive =
true;
81 bool m_moving =
false;
84 SnapMode m_snap = NoSnap;
85 Policy m_policy = AsNeeded;
86 QMetaObject::Connection m_window_connection;
89class QML_MATERIAL_API ScrollBarAttached :
public QObject {
92 ScrollBar* horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
93 Q_PROPERTY(ScrollBar* vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
95 explicit ScrollBarAttached(QObject* parent);
96 ScrollBar* horizontal()
const;
97 ScrollBar* vertical()
const;
98 void setHorizontal(ScrollBar*);
99 void setVertical(ScrollBar*);
100 Q_SIGNAL
void horizontalChanged();
101 Q_SIGNAL
void verticalChanged();
104 ScrollIndicatorAttached* m_attachment;
108QML_DECLARE_TYPEINFO(qml_material::ScrollBar, QML_HAS_ATTACHED_PROPERTIES)