11#include <QtGui/qstylehints.h>
12#include <QtGui/private/qguiapplication_p.h>
13#include <QtGui/private/qeventpoint_p.h>
14#include <QtGui/qpa/qplatformtheme.h>
15#include <QtQml/qqmlinfo.h>
16#include <QtQuick/private/qquickanimation_p.h>
17#include <QtQuick/private/qquicktransition_p.h>
18#include <QtQuick/private/qquicktransitionmanager_p_p.h>
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
95 void transition(QQuickTransition *transition, qreal position);
101 QQuickSwipe *m_swipe =
nullptr;
106 Q_DECLARE_PUBLIC(QQuickSwipe)
162 qmlExecuteDeferred(transition);
164 QQmlProperty defaultTarget(m_swipe, QLatin1String(
"position"));
165 QQmlListProperty<QQuickAbstractAnimation> animations = transition->animations();
166 const int count = animations.count(&animations);
167 for (
int i = 0; i < count; ++i) {
168 QQuickAbstractAnimation *anim = animations.at(&animations, i);
169 anim->setDefaultTarget(defaultTarget);
172 QList<QQuickStateAction> actions;
173 actions << QQuickStateAction(m_swipe, QLatin1String(
"position"), position);
174 QQuickTransitionManager::transition(actions, transition, m_swipe);
179 QQuickSwipePrivate::get(m_swipe)->finishTransition();
184 return swipe->d_func();
191 QQmlContext *context = component->creationContext();
195 context = qmlContext(control);
196 QQuickItem *item = qobject_cast<QQuickItem*>(component->beginCreate(context));
198 item->setParentItem(control);
199 component->completeCreate();
200 QJSEngine::setObjectOwnership(item, QJSEngine::JavaScriptOwnership);
207 if (qFuzzyIsNull(position))
215 if (right && position < 0.0) {
220 if (left && position > 0.0) {
230 if (qFuzzyIsNull(distance))
250 if ((distance < 0.0 && positionBeforePress == 0.0)
251 || (rightItem && positionBeforePress == -1.0 && distance < rightItem->width())
252 || (leftItem && positionBeforePress == 1.0 && qAbs(distance) > leftItem->width())) {
259 if ((distance > 0.0 && positionBeforePress == 0.0)
260 || (leftItem && positionBeforePress == 1.0 && qAbs(distance) < leftItem->width())
261 || (rightItem && positionBeforePress == -1.0 && qAbs(distance) > rightItem->width())) {
272 QQuickItem *relevantItem = showRelevantItemForPosition(position);
273 const qreal relevantWidth = relevantItem ? relevantItem->width() : 0.0;
274 const qreal contentItemX = position * relevantWidth + control->leftPadding();
279 if (QQuickItem *contentItem = control->contentItem())
280 contentItem->setProperty(
"x", contentItemX);
281 if (QQuickItem *background = control->background())
282 background->setProperty(
"x", position * relevantWidth);
284 if (QQuickItem *contentItem = control->contentItem())
285 contentItem->setX(contentItemX);
286 if (QQuickItem *background = control->background())
287 background->setX(position * relevantWidth);
295 q->setLeftItem(createDelegateItem(left));
297 qmlWarning(control) <<
"Failed to create left item:" << left->errors();
305 q->setBehindItem(createDelegateItem(behind));
307 qmlWarning(control) <<
"Failed to create behind item:" << behind->errors();
315 q->setRightItem(createDelegateItem(right));
317 qmlWarning(control) <<
"Failed to create right item:" << right->errors();
326 leftItem->setVisible(
true);
329 rightItem->setVisible(
false);
337 behindItem->setVisible(
true);
346 rightItem->setVisible(
true);
350 leftItem->setVisible(
false);
355 qmlWarning(control) <<
"cannot set both behind and left/right properties";
360 qmlWarning(control) <<
"left/right/behind properties may only be set when swipe.position is 0";
365 return left || right || behind;
370 return transitionManager && transitionManager->isRunning();
379 q->setPosition(newPosition);
384 if (!transitionManager)
385 transitionManager.reset(
new QQuickSwipeTransitionManager(q));
387 transitionManager->transition(transition, newPosition);
394 q->setComplete(qFuzzyCompare(qAbs(position), qreal(1.0)));
398 if (qFuzzyIsNull(position))
404QQuickSwipe::QQuickSwipe(QQuickSwipeDelegate *control)
405 : QObject(*(
new QQuickSwipePrivate(control)))
409QQmlComponent *QQuickSwipe::left()
const
411 Q_D(
const QQuickSwipe);
415void QQuickSwipe::setLeft(QQmlComponent *left)
422 d->warnAboutMixingDelegates();
426 if (!qFuzzyIsNull(d->position)) {
427 d->warnAboutSettingDelegatesWhileVisible();
435 d->leftItem =
nullptr;
438 d->control->setFiltersChildMouseEvents(d->hasDelegates());
443QQmlComponent *QQuickSwipe::behind()
const
445 Q_D(
const QQuickSwipe);
449void QQuickSwipe::setBehind(QQmlComponent *behind)
452 if (behind == d->behind)
455 if (d->left || d->right) {
456 d->warnAboutMixingDelegates();
460 if (!qFuzzyIsNull(d->position)) {
461 d->warnAboutSettingDelegatesWhileVisible();
468 delete d->behindItem;
469 d->behindItem =
nullptr;
472 d->control->setFiltersChildMouseEvents(d->hasDelegates());
474 emit behindChanged();
477QQmlComponent *QQuickSwipe::right()
const
479 Q_D(
const QQuickSwipe);
483void QQuickSwipe::setRight(QQmlComponent *right)
486 if (right == d->right)
490 d->warnAboutMixingDelegates();
494 if (!qFuzzyIsNull(d->position)) {
495 d->warnAboutSettingDelegatesWhileVisible();
503 d->rightItem =
nullptr;
506 d->control->setFiltersChildMouseEvents(d->hasDelegates());
511QQuickItem *QQuickSwipe::leftItem()
const
513 Q_D(
const QQuickSwipe);
517void QQuickSwipe::setLeftItem(QQuickItem *item)
520 if (item == d->leftItem)
527 d->leftItem->setParentItem(d->control);
529 if (qFuzzyIsNull(d->leftItem->z()))
530 d->leftItem->setZ(-2);
533 emit leftItemChanged();
536QQuickItem *QQuickSwipe::behindItem()
const
538 Q_D(
const QQuickSwipe);
539 return d->behindItem;
542void QQuickSwipe::setBehindItem(QQuickItem *item)
545 if (item == d->behindItem)
548 delete d->behindItem;
549 d->behindItem = item;
552 d->behindItem->setParentItem(d->control);
554 if (qFuzzyIsNull(d->behindItem->z()))
555 d->behindItem->setZ(-2);
558 emit behindItemChanged();
561QQuickItem *QQuickSwipe::rightItem()
const
563 Q_D(
const QQuickSwipe);
567void QQuickSwipe::setRightItem(QQuickItem *item)
570 if (item == d->rightItem)
577 d->rightItem->setParentItem(d->control);
579 if (qFuzzyIsNull(d->rightItem->z()))
580 d->rightItem->setZ(-2);
583 emit rightItemChanged();
586qreal QQuickSwipe::position()
const
588 Q_D(
const QQuickSwipe);
592void QQuickSwipe::setPosition(qreal position)
595 const qreal adjustedPosition = std::clamp(position, qreal(-1.0), qreal(1.0));
596 if (adjustedPosition == d->position)
599 d->position = adjustedPosition;
600 d->reposition(AnimatePosition);
601 emit positionChanged();
604bool QQuickSwipe::isComplete()
const
606 Q_D(
const QQuickSwipe);
610void QQuickSwipe::setComplete(
bool complete)
613 if (complete == d->complete)
616 d->complete = complete;
617 emit completeChanged();
622bool QQuickSwipe::isEnabled()
const
624 Q_D(
const QQuickSwipe);
628void QQuickSwipe::setEnabled(
bool enabled)
631 if (enabled == d->enabled)
634 d->enabled = enabled;
635 emit enabledChanged();
638QQuickTransition *QQuickSwipe::transition()
const
640 Q_D(
const QQuickSwipe);
641 return d->transition;
644void QQuickSwipe::setTransition(QQuickTransition *transition)
647 if (transition == d->transition)
650 d->transition = transition;
651 emit transitionChanged();
654void QQuickSwipe::open(QQuickSwipeDelegate::Side side)
657 if (qFuzzyCompare(qAbs(d->position), qreal(1.0)))
660 if ((side != QQuickSwipeDelegate::Left && side != QQuickSwipeDelegate::Right)
661 || (!d->left && !d->behind && side == QQuickSwipeDelegate::Left)
662 || (!d->right && !d->behind && side == QQuickSwipeDelegate::Right))
665 d->beginTransition(side);
666 d->wasComplete =
true;
667 d->velocityCalculator.reset();
668 d->positionBeforePress = d->position;
671void QQuickSwipe::close()
674 if (qFuzzyIsNull(d->position))
677 if (d->control->isPressed()) {
682 d->beginTransition(0.0);
683 d->waitForTransition =
true;
684 d->wasComplete =
false;
685 d->positionBeforePress = 0.0;
686 d->velocityCalculator.reset();
699 resizingBackground =
true;
701 QQuickItemPrivate *p = QQuickItemPrivate::get(background);
702 const bool extraAllocated = extra.isAllocated();
704 if (((!p->widthValid() || !extraAllocated || !extra->hasBackgroundWidth))
705 || (extraAllocated && (extra->hasLeftInset || extra->hasRightInset))) {
706 background->setWidth(width - getLeftInset() - getRightInset());
708 if (((!p->heightValid() || !extraAllocated || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
709 || (extraAllocated && (extra->hasTopInset || extra->hasBottomInset))) {
710 background->setY(getTopInset());
711 background->setHeight(height - getTopInset() - getBottomInset());
714 resizingBackground =
false;
719 Q_Q(QQuickSwipeDelegate);
720 const auto posInItem = item->mapToItem(q, event->position().toPoint());
725 if (qFuzzyIsNull(swipePrivate->position)) {
726 q->mousePressEvent(event);
730 setPressPoint(posInItem);
736 if (swipePrivate->complete)
737 forwardMouseEvent(event, item, posInItem);
742 swipePrivate->positionBeforePress = swipePrivate->position;
743 swipePrivate->velocityCalculator.startMeasuring(event->position().toPoint(), event->timestamp());
744 setPressPoint(item->mapToItem(q, event->position().toPoint()));
748 const bool delivered = attachedObjectsSetPressed(item, event->scenePosition(),
true);
756 Q_Q(QQuickSwipeDelegate);
759 if (QLineF(pressPoint, event->position()).length() > QGuiApplication::styleHints()->startDragDistance())
774 if (!swipePrivate->left && !swipePrivate->right && !swipePrivate->behind)
777 if (item != q && swipePrivate->complete) {
780 const auto posInItem = item->mapToItem(q, event->position().toPoint());
781 forwardMouseEvent(event, item, posInItem);
785 if (item == q && !pressed)
788 static constexpr QGuiApplicationPrivate::QLastCursorPosition uninitializedCursorPosition;
789 const qreal distance = (event->globalPosition() == uninitializedCursorPosition ? 0 :
790 (item->mapFromGlobal(event->globalPosition()) -
791 item->mapFromGlobal(event->points().first().globalPressPosition())).x());
792 if (!q->keepMouseGrab()) {
796 const bool overThreshold = QQuickDeliveryAgentPrivate::dragOverThreshold(distance,
798 if (window && overThreshold) {
799 QQuickItem *grabber = q->window()->mouseGrabberItem();
800 if (!grabber || !grabber->keepMouseGrab()) {
802 q->setKeepMouseGrab(
true);
804 swipe.setComplete(
false);
806 attachedObjectsSetPressed(item, event->scenePosition(),
false,
true);
811 if (q->keepMouseGrab()) {
816 if (swipePrivate->behind
817 || ((swipePrivate->left || swipePrivate->right)
818 && (qFuzzyIsNull(swipePrivate->positionBeforePress)
819 || (swipePrivate->positionBeforePress == -1.0 && distance >= 0.0)
820 || (swipePrivate->positionBeforePress == 1.0 && distance <= 0.0)))) {
824 QQuickItem *relevantItem = swipePrivate->createRelevantItemForDistance(distance);
827 const qreal normalizedDistance = relevantItem ? distance / relevantItem->width() : 0.0;
835 if (qFuzzyIsNull(normalizedDistance)) {
848 position = qFuzzyIsNull(distance) ? swipePrivate->positionBeforePress : 0;
850 position = normalizedDistance;
852 position = distance > 0 ? normalizedDistance - 1.0 : normalizedDistance + 1.0;
856 swipePrivate->transitionManager->cancel();
857 swipe.setPosition(position);
861 if (event->position().toPoint().y() < 0 || event->position().toPoint().y() > height) {
864 q->setPressed(
false);
870 return q->keepMouseGrab();
877 Q_Q(QQuickSwipeDelegate);
879 swipePrivate->velocityCalculator.stopMeasuring(event->position().toPoint(), event->timestamp());
881 const bool hadGrabbedMouse = q->keepMouseGrab();
882 q->setKeepMouseGrab(
false);
886 if (!qIsNull(swipePrivate->position))
887 q->setPressed(
false);
895 if (hadGrabbedMouse) {
898 q->setPressed(
false);
905 if (item != q && (swipePrivate->complete || swipePrivate->wasComplete))
906 forwardMouseEvent(event, item, item->mapFromScene(event->scenePosition()));
909 const qreal swipeVelocity = swipePrivate->velocityCalculator.velocity().x();
910 if (swipePrivate->position > 0.5 ||
911 (swipePrivate->position > 0.0 && swipeVelocity > exposeVelocityThreshold)) {
912 swipePrivate->beginTransition(1.0);
914 }
else if (swipePrivate->position < -0.5 ||
915 (swipePrivate->position < 0.0 && swipeVelocity < -exposeVelocityThreshold)) {
916 swipePrivate->beginTransition(-1.0);
922 if (!qFuzzyIsNull(swipePrivate->position))
923 swipePrivate->beginTransition(0.0);
928 attachedObjectsSetPressed(item, event->scenePosition(),
false);
931 return hadGrabbedMouse;
935
936
939 Q_Q(QQuickSwipeDelegate);
940 QMutableSinglePointEvent localizedEvent(*event);
941 QMutableEventPoint::setPosition(localizedEvent.point(0), localPos);
942 QGuiApplication::sendEvent(destination, &localizedEvent);
943 q->setPressed(!localizedEvent.isAccepted());
947
948
949
950
951
952
956 QVarLengthArray<QQuickItem *, 16> itemAndChildren;
957 itemAndChildren.append(item);
958 for (
int i = 0; i < itemAndChildren.size(); ++i) {
959 auto item = itemAndChildren.at(i);
960 auto posInItem = item->mapFromScene(scenePos);
961 if (item->contains(posInItem)) {
962 if (
Attached *attached = attachedObject(item)) {
963 const bool wasPressed = attached->isPressed();
964 attached->setPressed(pressed);
965 if (wasPressed && !pressed && !cancel)
966 emit attached->clicked();
970 for (
auto child : item->childItems())
971 itemAndChildren.append(child);
981 QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors;
982 if (anchors && (anchors->fill() || anchors->centerIn() || anchors->left().item || anchors->right().item)
983 && !item->property(
"_q_QQuickSwipeDelegate_warned").toBool()) {
984 qmlWarning(item) << QString::fromLatin1(
"SwipeDelegate: cannot use horizontal anchors with %1; unable to layout the item.").arg(itemName);
985 item->setProperty(
"_q_QQuickSwipeDelegate_warned",
true);
991 warnIfHorizontallyAnchored(background, QStringLiteral(
"background"));
992 warnIfHorizontallyAnchored(contentItem, QStringLiteral(
"contentItem"));
1001 QQuickItemDelegatePrivate::resizeContent();
1002 }
else if (contentItem) {
1003 Q_Q(QQuickSwipeDelegate);
1004 contentItem->setY(q->topPadding());
1005 contentItem->setWidth(q->availableWidth());
1006 contentItem->setHeight(q->availableHeight());
1012 return QQuickTheme::palette(QQuickTheme::ListView);
1016
1017
1018
1019
1020
1023 if (!childItem || !event)
1026 QQuickItem *item =
nullptr;
1028 if (childItem->acceptedMouseButtons() &&
1029 childItem->contains(childItem->mapFromScene(event->scenePosition()))) {
1032 const auto &childItems = childItem->childItems();
1033 for (
const auto &child: childItems) {
1034 if ((item = getPressedItem(child, event)))
1042QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent)
1043 : QQuickItemDelegate(*(
new QQuickSwipeDelegatePrivate(
this)), parent)
1046 setAcceptTouchEvents(
false);
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1071
1072
1073
1074
1075
1076
1077
1078
1079
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215QQuickSwipe *QQuickSwipeDelegate::swipe()
const
1217 Q_D(
const QQuickSwipeDelegate);
1218 return const_cast<QQuickSwipe*>(&d->swipe);
1221QQuickSwipeDelegateAttached *QQuickSwipeDelegate::qmlAttachedProperties(QObject *object)
1223 return new QQuickSwipeDelegateAttached(object);
1228 return item && (child == item || item->isAncestorOf(child));
1231bool QQuickSwipeDelegate::childMouseEventFilter(QQuickItem *child, QEvent *event)
1233 Q_D(QQuickSwipeDelegate);
1239 const QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
1240 if (!isChildOrGrandchildOf(child, swipePrivate->leftItem) && !isChildOrGrandchildOf(child, swipePrivate->behindItem)
1241 && !isChildOrGrandchildOf(child, swipePrivate->rightItem)) {
1245 switch (event->type()) {
1246 case QEvent::MouseButtonPress: {
1247 return d->handleMousePressEvent(child,
static_cast<QMouseEvent *>(event));
1248 }
case QEvent::MouseMove: {
1249 return d->handleMouseMoveEvent(child,
static_cast<QMouseEvent *>(event));
1250 }
case QEvent::MouseButtonRelease: {
1253 QMouseEvent *mouseEvent =
static_cast<QMouseEvent *>(event);
1254 QQuickItemDelegate::mouseReleaseEvent(mouseEvent);
1255 return d->handleMouseReleaseEvent(child, mouseEvent);
1256 }
case QEvent::UngrabMouse: {
1260 Attached *attached = attachedObject(child);
1262 attached->setPressed(
false);
1271void QQuickSwipeDelegate::mousePressEvent(QMouseEvent *event)
1273 Q_D(QQuickSwipeDelegate);
1274 QQuickItemDelegate::mousePressEvent(event);
1276 QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
1277 if (!swipePrivate->enabled)
1280 swipePrivate->positionBeforePress = swipePrivate->position;
1281 swipePrivate->velocityCalculator.startMeasuring(event->position().toPoint(), event->timestamp());
1283 if (swipePrivate->complete) {
1284 d->pressedItem = d->getPressedItem(d->swipe.rightItem(), event);
1285 if (!d->pressedItem)
1286 d->pressedItem = d->getPressedItem(d->swipe.leftItem(), event);
1288 d->handleMousePressEvent(d->pressedItem, event);
1292void QQuickSwipeDelegate::mouseMoveEvent(QMouseEvent *event)
1294 Q_D(QQuickSwipeDelegate);
1295 if (filtersChildMouseEvents())
1296 d->handleMouseMoveEvent(
this, event);
1298 QQuickItemDelegate::mouseMoveEvent(event);
1300 d->handleMouseMoveEvent(d->pressedItem, event);
1303void QQuickSwipeDelegate::mouseReleaseEvent(QMouseEvent *event)
1305 Q_D(QQuickSwipeDelegate);
1306 if (!filtersChildMouseEvents() || !d->handleMouseReleaseEvent(
this, event))
1307 QQuickItemDelegate::mouseReleaseEvent(event);
1309 if (d->pressedItem) {
1310 if (d->pressedItem->acceptedMouseButtons())
1311 d->handleMouseReleaseEvent(d->pressedItem, event);
1312 d->pressedItem =
nullptr;
1316void QQuickSwipeDelegate::mouseUngrabEvent()
1318 Q_D(QQuickSwipeDelegate);
1321 auto item = d->swipe.rightItem();
1323 if (
auto control = qmlobject_cast<QQuickControl *>(item))
1324 QQuickControlPrivate::get(control)->handleUngrab();
1325 Attached *attached = attachedObject(item);
1327 attached->setPressed(
false);
1329 item = d->swipe.leftItem();
1331 if (
auto control = qmlobject_cast<QQuickControl *>(item))
1332 QQuickControlPrivate::get(control)->handleUngrab();
1333 Attached *attached = attachedObject(item);
1335 attached->setPressed(
false);
1339 d->pressedItem =
nullptr;
1342void QQuickSwipeDelegate::touchEvent(QTouchEvent *event)
1349void QQuickSwipeDelegate::componentComplete()
1351 Q_D(QQuickSwipeDelegate);
1352 QQuickItemDelegate::componentComplete();
1353 QQuickSwipePrivate::get(&d->swipe)->reposition(DontAnimatePosition);
1356void QQuickSwipeDelegate::geometryChange(
const QRectF &newGeometry,
const QRectF &oldGeometry)
1358 Q_D(QQuickSwipeDelegate);
1359 QQuickControl::geometryChange(newGeometry, oldGeometry);
1361 if (isComponentComplete() && !qFuzzyCompare(newGeometry.width(), oldGeometry.width())) {
1362 QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
1363 swipePrivate->reposition(DontAnimatePosition);
1367QFont QQuickSwipeDelegate::defaultFont()
const
1369 return QQuickTheme::font(QQuickTheme::ListView);
1372#if QT_CONFIG(accessibility)
1373QAccessible::Role QQuickSwipeDelegate::accessibleRole()
const
1375 return QAccessible::ListItem;
1381 Q_DECLARE_PUBLIC(QQuickSwipeDelegateAttached)
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1408QQuickSwipeDelegateAttached::QQuickSwipeDelegateAttached(QObject *object)
1409 : QObject(*(
new QQuickSwipeDelegateAttachedPrivate), object)
1411 QQuickItem *item = qobject_cast<QQuickItem *>(object);
1417 item->setAcceptedMouseButtons(Qt::AllButtons);
1419 qWarning() <<
"SwipeDelegate attached property must be attached to an object deriving from Item";
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509bool QQuickSwipeDelegateAttached::isPressed()
const
1511 Q_D(
const QQuickSwipeDelegateAttached);
1515void QQuickSwipeDelegateAttached::setPressed(
bool pressed)
1517 Q_D(QQuickSwipeDelegateAttached);
1518 if (pressed == d->pressed)
1521 d->pressed = pressed;
1522 emit pressedChanged();
1527#include "moc_qquickswipe_p.cpp"
1528#include "moc_qquickswipedelegate_p.cpp"
bool handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event)
void forwardMouseEvent(QMouseEvent *event, QQuickItem *destination, QPointF localPos)
void resizeBackground() override
QPalette defaultPalette() const override
bool attachedObjectsSetPressed(QQuickItem *item, QPointF scenePos, bool pressed, bool cancel=false)
QQuickItem * getPressedItem(QQuickItem *childItem, QMouseEvent *event) const
bool handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event)
bool handleMousePressEvent(QQuickItem *item, QMouseEvent *event)
void resizeContent() override
void warnAboutMixingDelegates()
void createAndShowRightItem()
void createAndShowLeftItem()
QQuickVelocityCalculator velocityCalculator
QQuickItem * showRelevantItemForPosition(qreal position)
qreal positionBeforePress
QScopedPointer< QQuickSwipeTransitionManager > transitionManager
bool isTransitioning() const
void reposition(PositionAnimation animationPolicy)
bool hasDelegates() const
void createAndShowBehindItem()
QQuickTransition * transition
QQuickItem * createDelegateItem(QQmlComponent *component)
QQuickItem * createRelevantItemForDistance(qreal distance)
void beginTransition(qreal position)
QQuickSwipeDelegate * control
void warnAboutSettingDelegatesWhileVisible()
QQuickSwipeTransitionManager(QQuickSwipe *swipe)
void transition(QQuickTransition *transition, qreal position)
QQuickSwipeDelegateAttached Attached
Attached * attachedObject(QQuickItem *item)
static bool isChildOrGrandchildOf(QQuickItem *child, QQuickItem *item)
static const qreal exposeVelocityThreshold
static void warnIfHorizontallyAnchored(QQuickItem *item, const QString &itemName)