Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickscrollbar.cpp
Go to the documentation of this file.
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#include "qquickscrollbar_p.h"
7
8#include <QtQml/qqmlinfo.h>
9#include <QtQuick/private/qquickflickable_p.h>
10#if QT_CONFIG(accessibility)
11#include <QtQuick/private/qquickaccessibleattached_p.h>
12#endif
13
15
20
125static const QQuickItemPrivate::ChangeTypes QsbChangeTypes = QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed;
126static const QQuickItemPrivate::ChangeTypes QsbHorizontalChangeTypes = QsbChangeTypes | QQuickItemPrivate::ImplicitHeight;
127static const QQuickItemPrivate::ChangeTypes QsbVerticalChangeTypes = QsbChangeTypes | QQuickItemPrivate::ImplicitWidth;
128
130{
131 qreal visualPos = position;
132
133 if (minimumSize > size && size != 1.0)
134 visualPos = position / (1.0 - size) * (1.0 - minimumSize);
135
136 qreal maximumSize = qMax<qreal>(0.0, 1.0 - visualPos);
137 qreal visualSize = qMax<qreal>(minimumSize,
138 qMin<qreal>(qMax(size, minimumSize) + qMin<qreal>(0, visualPos),
139 maximumSize));
140
141 visualPos = qMax<qreal>(0,qMin<qreal>(visualPos,qMax<qreal>(0, 1.0 - visualSize)));
142
143 return VisualArea(visualPos, visualSize);
144}
145
147{
148 if (minimumSize > size && minimumSize != 1.0)
149 return position * (1.0 - size) / (1.0 - minimumSize);
150 return position;
151}
152
154{
155 const qreal effectiveStep = stepSize * (1.0 - size);
156 if (qFuzzyIsNull(effectiveStep))
157 return position;
158
159 return qRound(position / effectiveStep) * effectiveStep;
160}
161
163{
164 Q_Q(const QQuickScrollBar);
166 return logicalPosition(point.x() - q->leftPadding()) / q->availableWidth();
167 else
168 return logicalPosition(point.y() - q->topPadding()) / q->availableHeight();
169}
170
172{
173 Q_Q(QQuickScrollBar);
174 if (interactive == enabled)
175 return;
176
178 if (interactive) {
179 q->setAcceptedMouseButtons(Qt::LeftButton);
180#if QT_CONFIG(quicktemplates2_multitouch)
181 q->setAcceptTouchEvents(true);
182#endif
183#if QT_CONFIG(cursor)
184 q->setCursor(Qt::ArrowCursor);
185#endif
186 } else {
187 q->setAcceptedMouseButtons(Qt::NoButton);
188#if QT_CONFIG(quicktemplates2_multitouch)
189 q->setAcceptTouchEvents(false);
190#endif
191#if QT_CONFIG(cursor)
192 q->unsetCursor();
193#endif
194 q->ungrabMouse();
195 }
196 emit q->interactiveChanged();
197}
198
200{
201 Q_Q(QQuickScrollBar);
202#if QT_CONFIG(quicktemplates2_hover)
203 bool hover = hovered;
204#else
205 bool hover = false;
206#endif
207 q->setActive(moving || (interactive && (pressed || hover)));
208}
209
211{
212 Q_Q(QQuickScrollBar);
213 if (!contentItem)
214 return;
215
216 // - negative overshoot (pos < 0): clamp the pos to 0, and deduct the overshoot from the size
217 // - positive overshoot (pos + size > 1): clamp the size to 1-pos
218 const VisualArea visual = visualArea();
219
221 contentItem->setPosition(QPointF(q->leftPadding() + visual.position * q->availableWidth(), q->topPadding()));
222 contentItem->setSize(QSizeF(q->availableWidth() * visual.size, q->availableHeight()));
223 } else {
224 contentItem->setPosition(QPointF(q->leftPadding(), q->topPadding() + visual.position * q->availableHeight()));
225 contentItem->setSize(QSizeF(q->availableWidth(), q->availableHeight() * visual.size));
226 }
227}
228
230{
231 Q_Q(QQuickScrollBar);
233 QQuickIndicatorButton *indicatorButton = q->decreaseVisual();
234 if (!indicatorButton || item != indicatorButton->indicator()) {
235 indicatorButton = q->increaseVisual();
236 if (!indicatorButton || item != indicatorButton->indicator())
237 return;
238 }
239 if (indicatorButton)
240 emit indicatorButton->implicitIndicatorWidthChanged();
241}
242
244{
245 Q_Q(QQuickScrollBar);
247 QQuickIndicatorButton *indicatorButton = q->decreaseVisual();
248 if (!indicatorButton || item != indicatorButton->indicator()) {
249 indicatorButton = q->increaseVisual();
250 if (!indicatorButton || item != indicatorButton->indicator())
251 return;
252 }
253 if (indicatorButton)
254 emit indicatorButton->implicitIndicatorHeightChanged();
255}
256
258{
259 Q_Q(QQuickScrollBar);
260 QQuickControlPrivate::handlePress(point, timestamp);
261 if (QQuickIndicatorButton *indicatorButton = q->decreaseVisual()) {
262 QQuickItem *decreaseArrow = indicatorButton->indicator();
263 if (decreaseArrow && decreaseArrow->contains(q->mapToItem(decreaseArrow, point + QPointF(0.5, 0.5)))) {
264 indicatorButton->setPressed(true);
265 q->decrease();
266 return true;
267 }
268 }
269
270 if (QQuickIndicatorButton *increaseObject = q->increaseVisual()) {
271 QQuickItem *increaseArrow = increaseObject->indicator();
272 if (increaseArrow && increaseArrow->contains(q->mapToItem(increaseArrow, point + QPointF(0.5, 0.5)))) {
273 increaseObject->setPressed(true);
274 q->increase();
275 return true;
276 }
277 }
278
279 offset = positionAt(point) - position;
281 if (offset < 0 || offset > sz)
282 offset = sz / 2;
283 q->setPressed(true);
284 return true;
285}
286
288{
289 Q_Q(QQuickScrollBar);
290 QQuickControlPrivate::handleMove(point, timestamp);
291
292 /*
293 * handleMove() will be called as soon as you hold the mouse button down *anywhere* on the
294 * ScrollBar, including the increase/decrease button indicator areas. So without the following
295 * early return, it would move the scrollbar handle to one of its extremeties. That would
296 * ruin the behavior we would like when clicking e.g. the "increase button": To step the
297 * scrollbar gently.
298 */
299 if (!pressed)
300 return true;
301
302 qreal pos = qMax<qreal>(0.0, qMin<qreal>(positionAt(point) - offset, 1.0 - size));
305 q->setPosition(pos);
306 return true;
307}
308
310{
311 Q_Q(QQuickScrollBar);
312 QQuickControlPrivate::handleRelease(point, timestamp);
313
314 if (orientation == Qt::Vertical) {
315 if (point.y() < q->topPadding() || point.y() >= (q->height() - q->bottomPadding()))
316 return true;
317 } else /* orientation == Qt::Horizontal */{
318 if (point.x() < q->leftPadding() || point.x() >= (q->width() - q->rightPadding()))
319 return true;
320 }
321
322 qreal pos = qMax<qreal>(0.0, qMin<qreal>(positionAt(point) - offset, 1.0 - size));
325 q->setPosition(pos);
326 offset = 0.0;
327 q->setPressed(false);
328 return true;
329}
330
332{
333 Q_Q(QQuickScrollBar);
335 offset = 0.0;
336 q->setPressed(false);
337}
338
339void QQuickScrollBarPrivate::visualAreaChange(const VisualArea &newVisualArea, const VisualArea &oldVisualArea)
340{
341 Q_Q(QQuickScrollBar);
342 if (!qFuzzyCompare(newVisualArea.size, oldVisualArea.size))
343 emit q->visualSizeChanged();
344 if (!qFuzzyCompare(newVisualArea.position, oldVisualArea.position))
345 emit q->visualPositionChanged();
346}
347
348void QQuickScrollBarPrivate::updateHover(const QPointF &pos, std::optional<bool> newHoverState)
349{
350 Q_Q(QQuickScrollBar);
351 auto updateHoverOnButton = [&](QQuickIndicatorButton *sbButton) {
352 if (sbButton) {
353 bool hovered = newHoverState.value_or(false);
354 if (!newHoverState.has_value()) {
355 if (QQuickItem *indicator = sbButton->indicator())
356 hovered = indicator->contains(q->mapToItem(indicator, pos));
357 }
358 sbButton->setHovered(hovered);
359 }
360 };
361 updateHoverOnButton(q->decreaseVisual());
362 updateHoverOnButton(q->increaseVisual());
363}
364
367{
368 Q_D(QQuickScrollBar);
369 d->decreaseVisual = new QQuickIndicatorButton(this);
370 d->increaseVisual = new QQuickIndicatorButton(this);
371 setKeepMouseGrab(true);
373#if QT_CONFIG(quicktemplates2_multitouch)
375#endif
376#if QT_CONFIG(cursor)
378#endif
379}
380
382{
383 return new QQuickScrollBarAttached(object);
384}
385
399{
400 Q_D(const QQuickScrollBar);
401 return d->size;
402}
403
405{
406 Q_D(QQuickScrollBar);
407 if (!qt_is_finite(size))
408 return;
409 size = qBound(0.0, size, 1.0);
410 if (qFuzzyCompare(d->size, size))
411 return;
412 d->size = size;
413
414 auto oldVisualArea = d->visualArea();
415 d->size = qBound(0.0, size, 1.0);
416 if (d->size + d->position > 1.0) {
417 setPosition(1.0 - d->size);
418 oldVisualArea = d->visualArea();
419 }
420
422 d->resizeContent();
424 d->visualAreaChange(d->visualArea(), oldVisualArea);
425}
426
445{
446 Q_D(const QQuickScrollBar);
447 return d->position;
448}
449
451{
452 Q_D(QQuickScrollBar);
453 if (!qt_is_finite(position) || qFuzzyCompare(d->position, position))
454 return;
455
456 auto oldVisualArea = d->visualArea();
457 d->position = position;
459 d->resizeContent();
461 d->visualAreaChange(d->visualArea(), oldVisualArea);
462}
463
472{
473 Q_D(const QQuickScrollBar);
474 return d->stepSize;
475}
476
478{
479 Q_D(QQuickScrollBar);
480 if (!qt_is_finite(step) || qFuzzyCompare(d->stepSize, step))
481 return;
482
483 d->stepSize = step;
485}
486
500{
501 Q_D(const QQuickScrollBar);
502 return d->active;
503}
504
506{
507 Q_D(QQuickScrollBar);
508 if (d->active == active)
509 return;
510
511 d->active = active;
513}
514
521{
522 Q_D(const QQuickScrollBar);
523 return d->pressed;
524}
525
527{
528 Q_D(QQuickScrollBar);
529 if (!pressed) {
531 button->setPressed(false);
533 button->setPressed(false);
534 }
535 if (d->pressed == pressed)
536 return;
537
538 d->pressed = pressed;
539 setAccessibleProperty("pressed", pressed);
540 d->updateActive();
542}
543
559{
560 Q_D(const QQuickScrollBar);
561 return d->orientation;
562}
563
565{
566 Q_D(QQuickScrollBar);
567 if (d->orientation == orientation)
568 return;
569
570 d->orientation = orientation;
572 d->resizeContent();
574}
575
601{
602 Q_D(const QQuickScrollBar);
603 return d->snapMode;
604}
605
607{
608 Q_D(QQuickScrollBar);
609 if (d->snapMode == mode)
610 return;
611
612 d->snapMode = mode;
613 emit snapModeChanged();
614}
615
627{
628 Q_D(const QQuickScrollBar);
629 return d->interactive;
630}
631
633{
634 Q_D(QQuickScrollBar);
635 d->explicitInteractive = true;
636 d->setInteractive(interactive);
637}
638
640{
641 Q_D(QQuickScrollBar);
642 d->explicitInteractive = false;
643 d->setInteractive(true);
644}
645
672{
673 Q_D(const QQuickScrollBar);
674 return d->policy;
675}
676
678{
679 Q_D(QQuickScrollBar);
680 if (d->policy == policy)
681 return;
682
683 d->policy = policy;
684 emit policyChanged();
685}
686
697{
698 Q_D(const QQuickScrollBar);
699 return d->orientation == Qt::Horizontal;
700}
701
712{
713 Q_D(const QQuickScrollBar);
714 return d->orientation == Qt::Vertical;
715}
716
726{
727 Q_D(const QQuickScrollBar);
728 return d->minimumSize;
729}
730
732{
733 Q_D(QQuickScrollBar);
734 if (!qt_is_finite(minimumSize) || qFuzzyCompare(d->minimumSize, minimumSize))
735 return;
736
737 auto oldVisualArea = d->visualArea();
738 d->minimumSize = qBound(0.0, minimumSize, 1.0);
740 d->resizeContent();
741 emit minimumSizeChanged();
742 d->visualAreaChange(d->visualArea(), oldVisualArea);
743}
744
755{
756 Q_D(const QQuickScrollBar);
757 return d->visualArea().size;
758}
759
770{
771 Q_D(const QQuickScrollBar);
772 return d->visualArea().position;
773}
774
776{
777 Q_D(QQuickScrollBar);
778 return d->decreaseVisual;
779}
780
782{
783 Q_D(QQuickScrollBar);
784 return d->increaseVisual;
785}
786
795{
796 Q_D(QQuickScrollBar);
797 qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
798 bool wasActive = d->active;
799 setActive(true);
800 setPosition(qMin<qreal>(1.0 - d->size, d->position + step));
801 setActive(wasActive);
802}
803
812{
813 Q_D(QQuickScrollBar);
814 qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
815 bool wasActive = d->active;
816 setActive(true);
817 setPosition(qMax<qreal>(0.0, d->position - step));
818 setActive(wasActive);
819}
820
822{
823 Q_D(QQuickScrollBar);
825 d->handleMove(event->position(), event->timestamp());
826}
827
828#if QT_CONFIG(quicktemplates2_hover)
829void QQuickScrollBar::hoverChange()
830{
831 Q_D(QQuickScrollBar);
832 d->updateActive();
833}
834
836{
837 Q_D(QQuickScrollBar);
839 d->updateHover(event->position());
840 event->ignore();
841}
842
844{
845 Q_D(QQuickScrollBar);
847 d->updateHover(event->position());
848 event->ignore();
849}
850
852{
853 Q_D(QQuickScrollBar);
855
856 d->updateHover(QPoint(), false); //position is not needed when we force it to unhover
857 event->ignore();
858}
859#endif
860
862{
863 Q_D(QQuickScrollBar);
865
867 if (context) {
868 QQmlEngine::setContextForObject(d->decreaseVisual, context);
869 QQmlEngine::setContextForObject(d->increaseVisual, context);
870 }
871}
872
874{
875 Q_D(QQuickScrollBar);
878
880}
881
882#if QT_CONFIG(accessibility)
883void QQuickScrollBar::accessibilityActiveChanged(bool active)
884{
885 QQuickControl::accessibilityActiveChanged(active);
886
887 Q_D(QQuickScrollBar);
888 if (active) {
889 setAccessibleProperty("pressed", d->pressed);
890
891 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this)) {
892 connect(accessibleAttached, &QQuickAccessibleAttached::increaseAction, this, &QQuickScrollBar::increase);
893 connect(accessibleAttached, &QQuickAccessibleAttached::decreaseAction, this, &QQuickScrollBar::decrease);
894 }
895 } else {
896 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this)) {
897 disconnect(accessibleAttached, &QQuickAccessibleAttached::increaseAction, this, &QQuickScrollBar::increase);
898 disconnect(accessibleAttached, &QQuickAccessibleAttached::decreaseAction, this, &QQuickScrollBar::decrease);
899 }
900 }
901}
902
903QAccessible::Role QQuickScrollBar::accessibleRole() const
904{
905 return QAccessible::ScrollBar;
906}
907#endif
908
910{
911 if (flickable) {
912 // NOTE: Use removeItemChangeListener(Geometry) instead of updateOrRemoveGeometryChangeListener(Size).
913 // The latter doesn't remove the listener but only resets its types. Thus, it leaves behind a dangling
914 // pointer on destruction.
917 if (horizontal)
919 if (vertical)
921 }
922
923 flickable = item;
924
925 if (item) {
926 // Don't know how to combine these calls into one, and as long as they're separate calls,
927 // the remove* calls above need to be separate too, otherwise they will have no effect.
930 if (horizontal)
932 if (vertical)
933 initVertical();
934 }
935}
936
938{
940
942
943 // TODO: export QQuickFlickableVisibleArea
944 QObject *area = flickable->property("visibleArea").value<QObject *>();
945 QObject::connect(area, SIGNAL(widthRatioChanged(qreal)), horizontal, SLOT(setSize(qreal)));
947
948 // ensure that the ScrollBar is stacked above the Flickable in a ScrollView
950 if (parent && parent == flickable->parentItem())
952
953 // If a scroll bar was previously hidden (due to e.g. setting a new contentItem
954 // on a ScrollView), we need to make sure that we un-hide it.
955 if (auto control = qobject_cast<QQuickControl*>(q_func()->parent())) {
956 const auto visibility = horizontal->policy() != QQuickScrollBar::AlwaysOff
959 }
960
962 horizontal->setSize(area->property("widthRatio").toReal());
963 horizontal->setPosition(area->property("xPosition").toReal());
964}
965
967{
969
971
972 // TODO: export QQuickFlickableVisibleArea
973 QObject *area = flickable->property("visibleArea").value<QObject *>();
974 QObject::connect(area, SIGNAL(heightRatioChanged(qreal)), vertical, SLOT(setSize(qreal)));
976
977 // ensure that the ScrollBar is stacked above the Flickable in a ScrollView
979 if (parent && parent == flickable->parentItem())
981
982 if (auto control = qobject_cast<QQuickControl*>(q_func()->parent())) {
983 const auto visibility = vertical->policy() != QQuickScrollBar::AlwaysOff
985 QQuickControlPrivate::unhideOldItem(control, vertical, visibility);
986 }
987
989 vertical->setSize(area->property("heightRatio").toReal());
990 vertical->setPosition(area->property("yPosition").toReal());
991}
992
994{
996
998 // ScrollBar.qml has a binding to visible and ScrollView.qml has a binding to parent.
999 // If we just set visible to false and parent to null, these bindings will overwrite
1000 // them upon component completion as part of the binding evaluation.
1001 // That's why we remove the binding completely.
1002 const QQmlProperty visibleProperty(horizontal, QStringLiteral("visible"));
1003 const QQmlProperty parentProperty(horizontal, QStringLiteral("parent"));
1004 QQmlPropertyPrivate::removeBinding(visibleProperty);
1005 QQmlPropertyPrivate::removeBinding(parentProperty);
1006
1008
1009 // TODO: export QQuickFlickableVisibleArea
1010 QObject *area = flickable->property("visibleArea").value<QObject *>();
1011 QObject::disconnect(area, SIGNAL(widthRatioChanged(qreal)), horizontal, SLOT(setSize(qreal)));
1013}
1014
1016{
1018
1020 const QQmlProperty visibleProperty(vertical, QStringLiteral("visible"));
1021 const QQmlProperty parentProperty(vertical, QStringLiteral("parent"));
1022 QQmlPropertyPrivate::removeBinding(visibleProperty);
1023 QQmlPropertyPrivate::removeBinding(parentProperty);
1024
1026
1027 // TODO: export QQuickFlickableVisibleArea
1028 QObject *area = flickable->property("visibleArea").value<QObject *>();
1029 QObject::disconnect(area, SIGNAL(heightRatioChanged(qreal)), vertical, SLOT(setSize(qreal)));
1031}
1032
1034{
1036 p->moving = flickable->isMovingHorizontally();
1037 p->updateActive();
1038}
1039
1041{
1043 p->moving = flickable->isMovingVertically();
1044 p->updateActive();
1045}
1046
1047// TODO: QQuickFlickable::maxXYExtent()
1049{
1051};
1052
1054{
1055 if (!flickable)
1056 return;
1057
1059
1060 const qreal viewwidth = f->width();
1061 const qreal maxxextent = -f->maxXExtent() + f->minXExtent();
1062 const qreal cx = horizontal->position() * (maxxextent + viewwidth) - f->minXExtent();
1063
1064 if (!qIsNaN(cx) && !qFuzzyCompare(cx, flickable->contentX()))
1066}
1067
1069{
1070 if (!flickable)
1071 return;
1072
1074
1075 const qreal viewheight = f->height();
1076 const qreal maxyextent = -f->maxYExtent() + f->minYExtent();
1077 const qreal cy = vertical->position() * (maxyextent + viewheight) - f->minYExtent();
1078
1079 if (!qIsNaN(cy) && !qFuzzyCompare(cy, flickable->contentY()))
1081}
1082
1084{
1085 layoutVertical(true);
1086}
1087
1089{
1092 return;
1094 if (move)
1096}
1097
1099{
1101 if (vertical->parentItem() != flickable)
1102 return;
1104 if (move)
1106}
1107
1109{
1110 Q_UNUSED(item);
1111 Q_UNUSED(change);
1112 if (horizontal && horizontal->height() > 0) {
1113#ifdef QT_QUICK_NEW_GEOMETRY_CHANGED_HANDLING // TODO: correct/rename diff to oldGeometry
1114 bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), diff.height() - horizontal->height());
1115#else
1116 bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), item->height() - diff.height() - horizontal->height());
1117#endif
1118 if (flickable)
1119 layoutHorizontal(move);
1120 }
1121 if (vertical && vertical->width() > 0) {
1122#ifdef QT_QUICK_NEW_GEOMETRY_CHANGED_HANDLING // TODO: correct/rename diff to oldGeometry
1123 bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), diff.width() - vertical->width());
1124#else
1125 bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), item->width() - diff.width() - vertical->width());
1126#endif
1127 if (flickable)
1128 layoutVertical(move);
1129 }
1130}
1131
1133{
1134 if (item == vertical && flickable)
1135 layoutVertical(true);
1136}
1137
1139{
1140 if (item == horizontal && flickable)
1141 layoutHorizontal(true);
1142}
1143
1145{
1146 if (item == flickable)
1147 flickable = nullptr;
1148 if (item == horizontal)
1149 horizontal = nullptr;
1150 if (item == vertical)
1151 vertical = nullptr;
1152}
1153
1156{
1158 d->setFlickable(qobject_cast<QQuickFlickable *>(parent));
1159
1160 if (parent && !d->flickable && !qobject_cast<QQuickScrollView *>(parent))
1161 qmlWarning(parent) << "ScrollBar must be attached to a Flickable or ScrollView";
1162}
1163
1165{
1167 if (d->horizontal) {
1169 d->horizontal = nullptr;
1170 }
1171 if (d->vertical) {
1173 d->vertical = nullptr;
1174 }
1175 d->setFlickable(nullptr);
1176}
1177
1193{
1194 Q_D(const QQuickScrollBarAttached);
1195 return d->horizontal;
1196}
1197
1199{
1201 if (d->horizontal == horizontal)
1202 return;
1203
1204 if (d->horizontal) {
1207
1208 if (d->flickable)
1209 d->cleanupHorizontal();
1210 }
1211
1212 d->horizontal = horizontal;
1213
1214 if (horizontal) {
1215 if (!horizontal->parentItem())
1218
1221
1222 if (d->flickable)
1223 d->initHorizontal();
1224 }
1226}
1227
1243{
1244 Q_D(const QQuickScrollBarAttached);
1245 return d->vertical;
1246}
1247
1249{
1251 if (d->vertical == vertical)
1252 return;
1253
1254 if (d->vertical) {
1258
1259 if (d->flickable)
1260 d->cleanupVertical();
1261 }
1262
1263 d->vertical = vertical;
1264
1265 if (vertical) {
1266 if (!vertical->parentItem())
1269
1273
1274 if (d->flickable)
1275 d->initVertical();
1276 }
1278}
1279
1281
1282#include "moc_qquickscrollbar_p.cpp"
\inmodule QtGui
Definition qevent.h:245
\inmodule QtGui
Definition qevent.h:195
QObject * parent
Definition qobject.h:61
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
Definition qobject_p.h:298
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
Definition qobject_p.h:327
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3099
QVariant property(const char *name) const
Returns the value of the object's name property.
Definition qobject.cpp:4187
\inmodule QtCore\reentrant
Definition qpoint.h:214
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:333
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:338
\inmodule QtCore\reentrant
Definition qpoint.h:23
The QQmlContext class defines a context within a QML engine.
Definition qqmlcontext.h:25
static void setContextForObject(QObject *, QQmlContext *)
Sets the QQmlContext for the object to context.
static void removeBinding(const QQmlProperty &that)
The QQmlProperty class abstracts accessing properties on objects created from QML.
void itemImplicitWidthChanged(QQuickItem *item) override
static void unhideOldItem(QQuickControl *control, QQuickItem *item, UnhideVisibility visibility=UnhideVisibility::Show)
virtual bool handlePress(const QPointF &point, ulong timestamp)
QQuickDeferredPointer< QQuickItem > contentItem
static void hideOldItem(QQuickItem *item)
virtual void handleUngrab()
virtual bool handleRelease(const QPointF &point, ulong timestamp)
virtual bool handleMove(const QPointF &point, ulong timestamp)
void itemImplicitHeightChanged(QQuickItem *item) override
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void mirroredChanged()
void classBegin() override
Invoked after class creation, but before any properties have been set.
void mousePressEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
bool setAccessibleProperty(const char *propertyName, const QVariant &value)
bool isMirrored() const
\qmlproperty bool QtQuick.Controls::Control::mirrored \readonly
bool isMovingHorizontally() const
virtual void setContentX(qreal pos)
void movingHorizontallyChanged()
virtual void setContentY(qreal pos)
void movingVerticallyChanged()
bool isMovingVertically() const
static QQuickIndicatorButtonPrivate * get(QQuickIndicatorButton *button)
void executeIndicator(bool complete=false)
void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types)
void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types)
void updateOrAddItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
virtual void hoverEnterEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
void setSize(const QSizeF &size)
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
Definition qquickitem.h:73
void setParentItem(QQuickItem *parent)
virtual void hoverMoveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-move events for an item.
qreal y
Defines the item's y position relative to its parent.
Definition qquickitem.h:74
void setAcceptTouchEvents(bool accept)
If enabled is true, this sets the item to accept touch events; otherwise, touch events are not accept...
void setHeight(qreal)
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
Sets the mouse buttons accepted by this item to buttons.
qreal width
This property holds the width of this item.
Definition qquickitem.h:76
QQuickItem * parentItem() const
void stackAfter(const QQuickItem *)
Moves the specified sibling item to the index after this item within the list of children.
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
void setKeepMouseGrab(bool)
Sets whether the mouse input should remain exclusively with this item.
qreal height
This property holds the height of this item.
Definition qquickitem.h:77
void setPosition(const QPointF &)
void setWidth(qreal)
friend class QQuickAccessibleAttached
Definition qquickitem.h:474
void setX(qreal)
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void setY(qreal)
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override
void setFlickable(QQuickFlickable *flickable)
void layoutHorizontal(bool move=true)
void itemImplicitHeightChanged(QQuickItem *item) override
void itemDestroyed(QQuickItem *item) override
void itemImplicitWidthChanged(QQuickItem *item) override
void setVertical(QQuickScrollBar *vertical)
QQuickScrollBarAttached(QObject *parent=nullptr)
void setHorizontal(QQuickScrollBar *horizontal)
QQuickScrollBar * horizontal
void itemImplicitHeightChanged(QQuickItem *item) override
bool handlePress(const QPointF &point, ulong timestamp) override
qreal snapPosition(qreal position) const
static QQuickScrollBarPrivate * get(QQuickScrollBar *bar)
void itemImplicitWidthChanged(QQuickItem *item) override
void updateHover(const QPointF &pos, std::optional< bool > newHoverState={})
bool handleRelease(const QPointF &point, ulong timestamp) override
bool handleMove(const QPointF &point, ulong timestamp) override
void visualAreaChange(const VisualArea &newVisualArea, const VisualArea &oldVisualArea)
qreal positionAt(const QPointF &point) const
void setInteractive(bool interactive)
void resizeContent() override
qreal logicalPosition(qreal position) const
QQuickScrollBar::SnapMode snapMode
VisualArea visualArea() const
void activeChanged()
bool isPressed() const
\qmlproperty bool QtQuick.Controls::ScrollBar::pressed
void increase()
\qmlmethod void QtQuick.Controls::ScrollBar::increase()
QQuickIndicatorButton * increaseVisual()
void setMinimumSize(qreal minimumSize)
void pressedChanged()
void orientationChanged()
void positionChanged()
static QQuickScrollBarAttached * qmlAttachedProperties(QObject *object)
void setActive(bool active)
void setInteractive(bool interactive)
void setPolicy(Policy policy)
QQuickIndicatorButton * decreaseVisual()
bool isHorizontal() const
void stepSizeChanged()
Qt::Orientation orientation
void setPressed(bool pressed)
void setStepSize(qreal step)
void setOrientation(Qt::Orientation orientation)
void setPosition(qreal position)
void classBegin() override
Invoked after class creation, but before any properties have been set.
QQuickScrollBar(QQuickItem *parent=nullptr)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void mousePressEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
void setSnapMode(SnapMode mode)
void decrease()
\qmlmethod void QtQuick.Controls::ScrollBar::decrease()
bool isInteractive() const
bool isVertical() const
bool isActive() const
\qmlproperty bool QtQuick.Controls::ScrollBar::active
void setSize(qreal size)
\inmodule QtCore\reentrant
Definition qrect.h:483
constexpr qreal height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:718
constexpr qreal width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:715
\inmodule QtCore
Definition qsize.h:207
T value() const &
Definition qvariant.h:511
QPushButton * button
[2]
Combined button and popup list for selecting options.
@ LeftButton
Definition qnamespace.h:57
@ NoButton
Definition qnamespace.h:56
Orientation
Definition qnamespace.h:97
@ Horizontal
Definition qnamespace.h:98
@ Vertical
Definition qnamespace.h:99
@ ArrowCursor
static void * context
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:287
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition qfloat16.h:303
bool qIsNaN(qfloat16 f) noexcept
Definition qfloat16.h:238
int qRound(qfloat16 d) noexcept
Definition qfloat16.h:281
static int area(const QSize &s)
Definition qicon.cpp:152
constexpr const T & qBound(const T &min, const T &val, const T &max)
Definition qminmax.h:44
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
static Q_DECL_CONST_FUNCTION bool qt_is_finite(double d)
Definition qnumeric_p.h:111
#define SLOT(a)
Definition qobjectdefs.h:51
#define SIGNAL(a)
Definition qobjectdefs.h:52
n void setPosition(void) \n\
GLenum mode
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLfloat GLfloat f
GLenum GLuint GLintptr offset
struct _cl_event * event
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
QQmlContext * qmlContext(const QObject *obj)
Definition qqml.cpp:71
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
Definition qquickitem.h:483
static QT_BEGIN_NAMESPACE const QQuickItemPrivate::ChangeTypes QsbChangeTypes
Vertical or horizontal interactive scroll bar.
static const QQuickItemPrivate::ChangeTypes QsbVerticalChangeTypes
static const QQuickItemPrivate::ChangeTypes QsbHorizontalChangeTypes
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define QStringLiteral(str)
#define emit
#define Q_UNUSED(x)
unsigned long ulong
Definition qtypes.h:30
double qreal
Definition qtypes.h:92
#define enabled
myObject disconnect()
[26]
item setCursor(Qt::IBeamCursor)
[1]
QGraphicsItem * item
QSizePolicy policy
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent