81 Q_INTERFACES(QQmlParserStatus)
84 Q_PROPERTY(QQuickItem* target READ target WRITE setTarget NOTIFY targetChanged FINAL)
85 Q_PROPERTY(
bool active READ active WRITE setActive NOTIFY activeChanged FINAL)
86 Q_PROPERTY(qreal verticalStepSize READ verticalStepSize WRITE setVerticalStepSize RESET
87 resetVerticalStepSize NOTIFY verticalStepSizeChanged FINAL)
88 Q_PROPERTY(qreal horizontalStepSize READ horizontalStepSize WRITE setHorizontalStepSize RESET
89 resetHorizontalStepSize NOTIFY horizontalStepSizeChanged FINAL)
90 Q_PROPERTY(Qt::KeyboardModifiers pageScrollModifiers READ pageScrollModifiers WRITE
91 setPageScrollModifiers RESET resetPageScrollModifiers NOTIFY
92 pageScrollModifiersChanged FINAL)
93 Q_PROPERTY(Qt::KeyboardModifiers horizontalScrollModifiers READ horizontalScrollModifiers WRITE
94 setHorizontalScrollModifiers RESET resetHorizontalScrollModifiers NOTIFY
95 horizontalScrollModifiersChanged FINAL)
96 Q_PROPERTY(
bool filterMouseEvents READ filterMouseEvents WRITE setFilterMouseEvents NOTIFY
97 filterMouseEventsChanged FINAL)
98 Q_PROPERTY(
bool keyNavigationEnabled READ keyNavigationEnabled WRITE setKeyNavigationEnabled
99 NOTIFY keyNavigationEnabledChanged FINAL)
100 Q_PROPERTY(
bool blockTargetWheel MEMBER m_blockTargetWheel NOTIFY blockTargetWheelChanged FINAL)
101 Q_PROPERTY(
bool scrollFlickableTarget MEMBER m_scrollFlickableTarget NOTIFY
102 scrollFlickableTargetChanged FINAL)
104 bool useAnimation READ useAnimation WRITE setUseAnimation NOTIFY useAnimationChanged FINAL)
110 QQuickItem* target()
const;
111 void setTarget(QQuickItem* target);
113 auto active()
const -> bool;
114 void setActive(
bool);
115 qreal verticalStepSize()
const;
116 void setVerticalStepSize(qreal stepSize);
117 void resetVerticalStepSize();
119 qreal horizontalStepSize()
const;
120 void setHorizontalStepSize(qreal stepSize);
121 void resetHorizontalStepSize();
123 Qt::KeyboardModifiers pageScrollModifiers()
const;
124 void setPageScrollModifiers(Qt::KeyboardModifiers modifiers);
125 void resetPageScrollModifiers();
127 Qt::KeyboardModifiers horizontalScrollModifiers()
const;
128 void setHorizontalScrollModifiers(Qt::KeyboardModifiers modifiers);
129 void resetHorizontalScrollModifiers();
131 bool filterMouseEvents()
const;
132 void setFilterMouseEvents(
bool enabled);
134 bool keyNavigationEnabled()
const;
135 void setKeyNavigationEnabled(
bool enabled);
137 bool useAnimation()
const;
138 void setUseAnimation(
bool);
140 Q_INVOKABLE
bool scrollUp(qreal stepSize = -1);
141 Q_INVOKABLE
bool scrollDown(qreal stepSize = -1);
143 Q_INVOKABLE
bool scrollLeft(qreal stepSize = -1);
144 Q_INVOKABLE
bool scrollRight(qreal stepSize = -1);
147 void targetChanged();
148 void activeChanged();
149 void verticalStepSizeChanged();
150 void horizontalStepSizeChanged();
151 void pageScrollModifiersChanged();
152 void horizontalScrollModifiersChanged();
153 void filterMouseEventsChanged();
154 void keyNavigationEnabledChanged();
155 void blockTargetWheelChanged();
156 void scrollFlickableTargetChanged();
157 void useAnimationChanged();
163 bool eventFilter(QObject* watched, QEvent* event)
override;
166 void refreshAttach();
169 void rebindScrollBarV();
170 void rebindScrollBarH();
174 void rebindScrollBar(ScrollBar& scrollBar);
175 void classBegin()
override;
176 void componentComplete()
override;
178 void setScrolling(
bool scrolling);
179 bool scrollFlickable(QPointF pixelDelta, QPointF angleDelta = {},
180 Qt::KeyboardModifiers modifiers = Qt::NoModifier);
182 QPointer<QQuickItem> m_target;
185 QMetaObject::Connection m_verticalChangedConnection;
186 QMetaObject::Connection m_horizontalChangedConnection;
188 qreal m_defaultPixelStepSize = 20 * QGuiApplication::styleHints()->wheelScrollLines();
189 qreal m_verticalStepSize = m_defaultPixelStepSize;
190 qreal m_horizontalStepSize = m_defaultPixelStepSize;
191 bool m_explicitVStepSize =
false;
192 bool m_explicitHStepSize =
false;
193 bool m_wheelScrolling =
false;
194 constexpr static qreal m_wheelScrollingDuration = 400;
195 bool m_filterMouseEvents =
false;
196 bool m_keyNavigationEnabled =
false;
197 bool m_blockTargetWheel =
true;
198 bool m_scrollFlickableTarget =
true;
199 constexpr static Qt::KeyboardModifiers m_defaultHorizontalScrollModifiers = Qt::AltModifier;
200 constexpr static Qt::KeyboardModifiers m_defaultPageScrollModifiers =
201 Qt::ControlModifier | Qt::ShiftModifier;
202 Qt::KeyboardModifiers m_pageScrollModifiers = m_defaultPageScrollModifiers;
203 Qt::KeyboardModifiers m_horizontalScrollModifiers = m_defaultHorizontalScrollModifiers;
204 QTimer m_wheelScrollingTimer;
207 QQmlEngine* m_engine =
nullptr;
208 bool m_wasTouched =
false;
211 QQmlProperty originX, originY;
212 QQmlProperty leftMargin, rightMargin;
213 QQmlProperty topMargin, bottomMargin;
214 QQmlProperty contentX, contentY;
215 QQmlProperty contentHeight, contentWidth;
216 QQmlProperty height, width;
217 QQmlProperty interactive;
221 QQmlProperty scrollBar;
222 QQmlProperty stepSize;
223 QMetaMethod increaseMethod;
224 QMetaMethod decreaseMethod;
225 QQuickItem* item =
nullptr;
226 bool valid()
const {
return item !=
nullptr; };
227 } m_scrollBarV, m_scrollBarH;
229 bool m_useAnimation =
false;