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
76
77
78
98 void transition(QQuickTransition *transition, qreal position);
104 QQuickSwipe *m_swipe =
nullptr;
109 Q_DECLARE_PUBLIC(QQuickSwipe)
165 qmlExecuteDeferred(transition);
167 QQmlProperty defaultTarget(m_swipe, QLatin1String(
"position"));
168 QQmlListProperty<QQuickAbstractAnimation> animations = transition->animations();
169 const int count = animations.count(&animations);
170 for (
int i = 0; i < count; ++i) {
171 QQuickAbstractAnimation *anim = animations.at(&animations, i);
172 anim->setDefaultTarget(defaultTarget);
175 QList<QQuickStateAction> actions;
176 actions << QQuickStateAction(m_swipe, QLatin1String(
"position"), position);
177 QQuickTransitionManager::transition(actions, transition, m_swipe);
182 QQuickSwipePrivate::get(m_swipe)->finishTransition();
187 return swipe->d_func();
194 QQmlContext *context = component->creationContext();
198 context = qmlContext(control);
199 QQuickItem *item = qobject_cast<QQuickItem*>(component->beginCreate(context));
201 item->setParentItem(control);
202 component->completeCreate();
203 QJSEngine::setObjectOwnership(item, QJSEngine::JavaScriptOwnership);
210 if (qFuzzyIsNull(position))
218 if (right && position < 0.0) {
223 if (left && position > 0.0) {
233 if (qFuzzyIsNull(distance))
253 if ((distance < 0.0 && positionBeforePress == 0.0)
254 || (rightItem && positionBeforePress == -1.0 && distance < rightItem->width())
255 || (leftItem && positionBeforePress == 1.0 && qAbs(distance) > leftItem->width())) {
262 if ((distance > 0.0 && positionBeforePress == 0.0)
263 || (leftItem && positionBeforePress == 1.0 && qAbs(distance) < leftItem->width())
264 || (rightItem && positionBeforePress == -1.0 && qAbs(distance) > rightItem->width())) {
275 QQuickItem *relevantItem = showRelevantItemForPosition(position);
276 const qreal relevantWidth = relevantItem ? relevantItem->width() : 0.0;
277 const qreal contentItemX = position * relevantWidth + control->leftPadding();
282 if (QQuickItem *contentItem = control->contentItem())
283 contentItem->setProperty(
"x", contentItemX);
284 if (QQuickItem *background = control->background())
285 background->setProperty(
"x", position * relevantWidth);
287 if (QQuickItem *contentItem = control->contentItem())
288 contentItem->setX(contentItemX);
289 if (QQuickItem *background = control->background())
290 background->setX(position * relevantWidth);
298 q->setLeftItem(createDelegateItem(left));
300 qmlWarning(control) <<
"Failed to create left item:" << left->errors();
308 q->setBehindItem(createDelegateItem(behind));
310 qmlWarning(control) <<
"Failed to create behind item:" << behind->errors();
318 q->setRightItem(createDelegateItem(right));
320 qmlWarning(control) <<
"Failed to create right item:" << right->errors();
329 leftItem->setVisible(
true);
332 rightItem->setVisible(
false);
340 behindItem->setVisible(
true);
349 rightItem->setVisible(
true);
353 leftItem->setVisible(
false);
358 qmlWarning(control) <<
"cannot set both behind and left/right properties";
363 qmlWarning(control) <<
"left/right/behind properties may only be set when swipe.position is 0";
368 return left || right || behind;
373 return transitionManager && transitionManager->isRunning();
382 q->setPosition(newPosition);
387 if (!transitionManager)
388 transitionManager.reset(
new QQuickSwipeTransitionManager(q));
390 transitionManager->transition(transition, newPosition);
397 q->setComplete(qFuzzyCompare(qAbs(position), qreal(1.0)));
401 if (qFuzzyIsNull(position))
407QQuickSwipe::QQuickSwipe(QQuickSwipeDelegate *control)
408 : QObject(*(
new QQuickSwipePrivate(control)))
412QQmlComponent *QQuickSwipe::left()
const
414 Q_D(
const QQuickSwipe);
418void QQuickSwipe::setLeft(QQmlComponent *left)
425 d->warnAboutMixingDelegates();
429 if (!qFuzzyIsNull(d->position)) {
430 d->warnAboutSettingDelegatesWhileVisible();
438 d->leftItem =
nullptr;
441 d->control->setFiltersChildMouseEvents(d->hasDelegates());
446QQmlComponent *QQuickSwipe::behind()
const
448 Q_D(
const QQuickSwipe);
452void QQuickSwipe::setBehind(QQmlComponent *behind)
455 if (behind == d->behind)
458 if (d->left || d->right) {
459 d->warnAboutMixingDelegates();
463 if (!qFuzzyIsNull(d->position)) {
464 d->warnAboutSettingDelegatesWhileVisible();
471 delete d->behindItem;
472 d->behindItem =
nullptr;
475 d->control->setFiltersChildMouseEvents(d->hasDelegates());
477 emit behindChanged();
480QQmlComponent *QQuickSwipe::right()
const
482 Q_D(
const QQuickSwipe);
486void QQuickSwipe::setRight(QQmlComponent *right)
489 if (right == d->right)
493 d->warnAboutMixingDelegates();
497 if (!qFuzzyIsNull(d->position)) {
498 d->warnAboutSettingDelegatesWhileVisible();
506 d->rightItem =
nullptr;
509 d->control->setFiltersChildMouseEvents(d->hasDelegates());
514QQuickItem *QQuickSwipe::leftItem()
const
516 Q_D(
const QQuickSwipe);
520void QQuickSwipe::setLeftItem(QQuickItem *item)
523 if (item == d->leftItem)
530 d->leftItem->setParentItem(d->control);
532 if (qFuzzyIsNull(d->leftItem->z()))
533 d->leftItem->setZ(-2);
536 emit leftItemChanged();
539QQuickItem *QQuickSwipe::behindItem()
const
541 Q_D(
const QQuickSwipe);
542 return d->behindItem;
545void QQuickSwipe::setBehindItem(QQuickItem *item)
548 if (item == d->behindItem)
551 delete d->behindItem;
552 d->behindItem = item;
555 d->behindItem->setParentItem(d->control);
557 if (qFuzzyIsNull(d->behindItem->z()))
558 d->behindItem->setZ(-2);
561 emit behindItemChanged();
564QQuickItem *QQuickSwipe::rightItem()
const
566 Q_D(
const QQuickSwipe);
570void QQuickSwipe::setRightItem(QQuickItem *item)
573 if (item == d->rightItem)
580 d->rightItem->setParentItem(d->control);
582 if (qFuzzyIsNull(d->rightItem->z()))
583 d->rightItem->setZ(-2);
586 emit rightItemChanged();
589qreal QQuickSwipe::position()
const
591 Q_D(
const QQuickSwipe);
595void QQuickSwipe::setPosition(qreal position)
598 const qreal adjustedPosition = std::clamp(position, qreal(-1.0), qreal(1.0));
599 if (adjustedPosition == d->position)
602 d->position = adjustedPosition;
603 d->reposition(AnimatePosition);
604 emit positionChanged();
607bool QQuickSwipe::isComplete()
const
609 Q_D(
const QQuickSwipe);
613void QQuickSwipe::setComplete(
bool complete)
616 if (complete == d->complete)
619 d->complete = complete;
620 emit completeChanged();
625bool QQuickSwipe::isEnabled()
const
627 Q_D(
const QQuickSwipe);
631void QQuickSwipe::setEnabled(
bool enabled)
634 if (enabled == d->enabled)
637 d->enabled = enabled;
638 emit enabledChanged();
641QQuickTransition *QQuickSwipe::transition()
const
643 Q_D(
const QQuickSwipe);
644 return d->transition;
647void QQuickSwipe::setTransition(QQuickTransition *transition)
650 if (transition == d->transition)
653 d->transition = transition;
654 emit transitionChanged();
657void QQuickSwipe::open(QQuickSwipeDelegate::Side side)
660 if (qFuzzyCompare(qAbs(d->position), qreal(1.0)))
663 if ((side != QQuickSwipeDelegate::Left && side != QQuickSwipeDelegate::Right)
664 || (!d->left && !d->behind && side == QQuickSwipeDelegate::Left)
665 || (!d->right && !d->behind && side == QQuickSwipeDelegate::Right))
668 d->beginTransition(side);
669 d->wasComplete =
true;
670 d->velocityCalculator.reset();
671 d->positionBeforePress = d->position;
674void QQuickSwipe::close()
677 if (qFuzzyIsNull(d->position))
680 if (d->control->isPressed()) {
685 d->beginTransition(0.0);
686 d->waitForTransition =
true;
687 d->wasComplete =
false;
688 d->positionBeforePress = 0.0;
689 d->velocityCalculator.reset();
702 resizingBackground =
true;
704 QQuickItemPrivate *p = QQuickItemPrivate::get(background);
705 const bool extraAllocated = extra.isAllocated();
707 if (((!p->widthValid() || !extraAllocated || !extra->hasBackgroundWidth))
708 || (extraAllocated && (extra->hasLeftInset || extra->hasRightInset))) {
709 background->setWidth(width - getLeftInset() - getRightInset());
711 if (((!p->heightValid() || !extraAllocated || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
712 || (extraAllocated && (extra->hasTopInset || extra->hasBottomInset))) {
713 background->setY(getTopInset());
714 background->setHeight(height - getTopInset() - getBottomInset());
717 resizingBackground =
false;
722 Q_Q(QQuickSwipeDelegate);
723 const auto posInItem = item->mapToItem(q, event->position().toPoint());
728 if (qFuzzyIsNull(swipePrivate->position)) {
729 q->mousePressEvent(event);
733 setPressPoint(posInItem);
739 if (swipePrivate->complete)
740 forwardMouseEvent(event, item, posInItem);
745 swipePrivate->positionBeforePress = swipePrivate->position;
746 swipePrivate->velocityCalculator.startMeasuring(event->position().toPoint(), event->timestamp());
747 setPressPoint(item->mapToItem(q, event->position().toPoint()));
751 const bool delivered = attachedObjectsSetPressed(item, event->scenePosition(),
true);
759 Q_Q(QQuickSwipeDelegate);
762 if (QLineF(pressPoint, event->position()).length() > QGuiApplication::styleHints()->startDragDistance())
777 if (!swipePrivate->left && !swipePrivate->right && !swipePrivate->behind)
780 if (item != q && swipePrivate->complete) {
783 const auto posInItem = item->mapToItem(q, event->position().toPoint());
784 forwardMouseEvent(event, item, posInItem);
788 if (item == q && !pressed)
791 static constexpr QGuiApplicationPrivate::QLastCursorPosition uninitializedCursorPosition;
792 const qreal distance = (event->globalPosition() == uninitializedCursorPosition ? 0 :
793 (item->mapFromGlobal(event->globalPosition()) -
794 item->mapFromGlobal(event->points().first().globalPressPosition())).x());
795 if (!q->keepMouseGrab()) {
799 const bool overThreshold = QQuickDeliveryAgentPrivate::dragOverThreshold(distance,
801 if (window && overThreshold) {
802 QQuickItem *grabber = q->window()->mouseGrabberItem();
803 if (!grabber || !grabber->keepMouseGrab()) {
805 q->setKeepMouseGrab(
true);
807 swipe.setComplete(
false);
809 attachedObjectsSetPressed(item, event->scenePosition(),
false,
true);
814 if (q->keepMouseGrab()) {
819 if (swipePrivate->behind
820 || ((swipePrivate->left || swipePrivate->right)
821 && (qFuzzyIsNull(swipePrivate->positionBeforePress)
822 || (swipePrivate->positionBeforePress == -1.0 && distance >= 0.0)
823 || (swipePrivate->positionBeforePress == 1.0 && distance <= 0.0)))) {
827 QQuickItem *relevantItem = swipePrivate->createRelevantItemForDistance(distance);
830 const qreal normalizedDistance = relevantItem ? distance / relevantItem->width() : 0.0;
838 if (qFuzzyIsNull(normalizedDistance)) {
851 position = qFuzzyIsNull(distance) ? swipePrivate->positionBeforePress : 0;
853 position = normalizedDistance;
855 position = distance > 0 ? normalizedDistance - 1.0 : normalizedDistance + 1.0;
859 swipePrivate->transitionManager->cancel();
860 swipe.setPosition(position);
864 if (event->position().toPoint().y() < 0 || event->position().toPoint().y() > height) {
867 q->setPressed(
false);
873 return q->keepMouseGrab();
880 Q_Q(QQuickSwipeDelegate);
882 swipePrivate->velocityCalculator.stopMeasuring(event->position().toPoint(), event->timestamp());
884 const bool hadGrabbedMouse = q->keepMouseGrab();
885 q->setKeepMouseGrab(
false);
889 if (!qIsNull(swipePrivate->position))
890 q->setPressed(
false);
898 if (hadGrabbedMouse) {
901 q->setPressed(
false);
908 if (item != q && (swipePrivate->complete || swipePrivate->wasComplete))
909 forwardMouseEvent(event, item, item->mapFromScene(event->scenePosition()));
912 const qreal swipeVelocity = swipePrivate->velocityCalculator.velocity().x();
913 if (swipePrivate->position > 0.5 ||
914 (swipePrivate->position > 0.0 && swipeVelocity > exposeVelocityThreshold)) {
915 swipePrivate->beginTransition(1.0);
917 }
else if (swipePrivate->position < -0.5 ||
918 (swipePrivate->position < 0.0 && swipeVelocity < -exposeVelocityThreshold)) {
919 swipePrivate->beginTransition(-1.0);
925 if (!qFuzzyIsNull(swipePrivate->position))
926 swipePrivate->beginTransition(0.0);
931 attachedObjectsSetPressed(item, event->scenePosition(),
false);
934 return hadGrabbedMouse;
938
939
942 Q_Q(QQuickSwipeDelegate);
943 QMutableSinglePointEvent localizedEvent(*event);
944 QMutableEventPoint::setPosition(localizedEvent.point(0), localPos);
945 QGuiApplication::sendEvent(destination, &localizedEvent);
946 q->setPressed(!localizedEvent.isAccepted());
950
951
952
953
954
955
959 QVarLengthArray<QQuickItem *, 16> itemAndChildren;
960 itemAndChildren.append(item);
961 for (
int i = 0; i < itemAndChildren.size(); ++i) {
962 auto item = itemAndChildren.at(i);
963 auto posInItem = item->mapFromScene(scenePos);
964 if (item->contains(posInItem)) {
965 if (
Attached *attached = attachedObject(item)) {
966 const bool wasPressed = attached->isPressed();
967 attached->setPressed(pressed);
968 if (wasPressed && !pressed && !cancel)
969 emit attached->clicked();
973 for (
auto child : item->childItems())
974 itemAndChildren.append(child);
984 QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors;
985 if (anchors && (anchors->fill() || anchors->centerIn() || anchors->left().item || anchors->right().item)
986 && !item->property(
"_q_QQuickSwipeDelegate_warned").toBool()) {
987 qmlWarning(item) << QString::fromLatin1(
"SwipeDelegate: cannot use horizontal anchors with %1; unable to layout the item.").arg(itemName);
988 item->setProperty(
"_q_QQuickSwipeDelegate_warned",
true);
994 warnIfHorizontallyAnchored(background, QStringLiteral(
"background"));
995 warnIfHorizontallyAnchored(contentItem, QStringLiteral(
"contentItem"));
1004 QQuickItemDelegatePrivate::resizeContent();
1005 }
else if (contentItem) {
1006 Q_Q(QQuickSwipeDelegate);
1007 contentItem->setY(q->topPadding());
1008 contentItem->setWidth(q->availableWidth());
1009 contentItem->setHeight(q->availableHeight());
1015 return QQuickTheme::palette(QQuickTheme::ListView);
1019
1020
1021
1022
1023
1026 if (!childItem || !event)
1029 QQuickItem *item =
nullptr;
1031 if (childItem->acceptedMouseButtons() &&
1032 childItem->contains(childItem->mapFromScene(event->scenePosition()))) {
1035 const auto &childItems = childItem->childItems();
1036 for (
const auto &child: childItems) {
1037 if ((item = getPressedItem(child, event)))
1045QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent)
1046 : QQuickItemDelegate(*(
new QQuickSwipeDelegatePrivate(
this)), parent)
1049 setAcceptTouchEvents(
false);
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1074
1075
1076
1077
1078
1079
1080
1081
1082
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
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
1215
1216
1217
1218QQuickSwipe *QQuickSwipeDelegate::swipe()
const
1220 Q_D(
const QQuickSwipeDelegate);
1221 return const_cast<QQuickSwipe*>(&d->swipe);
1224QQuickSwipeDelegateAttached *QQuickSwipeDelegate::qmlAttachedProperties(QObject *object)
1226 return new QQuickSwipeDelegateAttached(object);
1231 return item && (child == item || item->isAncestorOf(child));
1234bool QQuickSwipeDelegate::childMouseEventFilter(QQuickItem *child, QEvent *event)
1236 Q_D(QQuickSwipeDelegate);
1242 const QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
1243 if (!isChildOrGrandchildOf(child, swipePrivate->leftItem) && !isChildOrGrandchildOf(child, swipePrivate->behindItem)
1244 && !isChildOrGrandchildOf(child, swipePrivate->rightItem)) {
1248 switch (event->type()) {
1249 case QEvent::MouseButtonPress: {
1250 return d->handleMousePressEvent(child,
static_cast<QMouseEvent *>(event));
1251 }
case QEvent::MouseMove: {
1252 return d->handleMouseMoveEvent(child,
static_cast<QMouseEvent *>(event));
1253 }
case QEvent::MouseButtonRelease: {
1256 QMouseEvent *mouseEvent =
static_cast<QMouseEvent *>(event);
1257 QQuickItemDelegate::mouseReleaseEvent(mouseEvent);
1258 return d->handleMouseReleaseEvent(child, mouseEvent);
1259 }
case QEvent::UngrabMouse: {
1263 Attached *attached = attachedObject(child);
1265 attached->setPressed(
false);
1274void QQuickSwipeDelegate::mousePressEvent(QMouseEvent *event)
1276 Q_D(QQuickSwipeDelegate);
1277 QQuickItemDelegate::mousePressEvent(event);
1279 QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
1280 if (!swipePrivate->enabled)
1283 swipePrivate->positionBeforePress = swipePrivate->position;
1284 swipePrivate->velocityCalculator.startMeasuring(event->position().toPoint(), event->timestamp());
1286 if (swipePrivate->complete) {
1287 d->pressedItem = d->getPressedItem(d->swipe.rightItem(), event);
1288 if (!d->pressedItem)
1289 d->pressedItem = d->getPressedItem(d->swipe.leftItem(), event);
1291 d->handleMousePressEvent(d->pressedItem, event);
1295void QQuickSwipeDelegate::mouseMoveEvent(QMouseEvent *event)
1297 Q_D(QQuickSwipeDelegate);
1298 if (filtersChildMouseEvents())
1299 d->handleMouseMoveEvent(
this, event);
1301 QQuickItemDelegate::mouseMoveEvent(event);
1303 d->handleMouseMoveEvent(d->pressedItem, event);
1306void QQuickSwipeDelegate::mouseReleaseEvent(QMouseEvent *event)
1308 Q_D(QQuickSwipeDelegate);
1309 if (!filtersChildMouseEvents() || !d->handleMouseReleaseEvent(
this, event))
1310 QQuickItemDelegate::mouseReleaseEvent(event);
1312 if (d->pressedItem) {
1313 if (d->pressedItem->acceptedMouseButtons())
1314 d->handleMouseReleaseEvent(d->pressedItem, event);
1315 d->pressedItem =
nullptr;
1319void QQuickSwipeDelegate::mouseUngrabEvent()
1321 Q_D(QQuickSwipeDelegate);
1324 auto item = d->swipe.rightItem();
1326 if (
auto control = qmlobject_cast<QQuickControl *>(item))
1327 QQuickControlPrivate::get(control)->handleUngrab();
1328 Attached *attached = attachedObject(item);
1330 attached->setPressed(
false);
1332 item = d->swipe.leftItem();
1334 if (
auto control = qmlobject_cast<QQuickControl *>(item))
1335 QQuickControlPrivate::get(control)->handleUngrab();
1336 Attached *attached = attachedObject(item);
1338 attached->setPressed(
false);
1342 d->pressedItem =
nullptr;
1345void QQuickSwipeDelegate::touchEvent(QTouchEvent *event)
1352void QQuickSwipeDelegate::componentComplete()
1354 Q_D(QQuickSwipeDelegate);
1355 QQuickItemDelegate::componentComplete();
1356 QQuickSwipePrivate::get(&d->swipe)->reposition(DontAnimatePosition);
1359void QQuickSwipeDelegate::geometryChange(
const QRectF &newGeometry,
const QRectF &oldGeometry)
1361 Q_D(QQuickSwipeDelegate);
1362 QQuickControl::geometryChange(newGeometry, oldGeometry);
1364 if (isComponentComplete() && !qFuzzyCompare(newGeometry.width(), oldGeometry.width())) {
1365 QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
1366 swipePrivate->reposition(DontAnimatePosition);
1370QFont QQuickSwipeDelegate::defaultFont()
const
1372 return QQuickTheme::font(QQuickTheme::ListView);
1375#if QT_CONFIG(accessibility)
1376QAccessible::Role QQuickSwipeDelegate::accessibleRole()
const
1378 return QAccessible::ListItem;
1384 Q_DECLARE_PUBLIC(QQuickSwipeDelegateAttached)
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1411QQuickSwipeDelegateAttached::QQuickSwipeDelegateAttached(QObject *object)
1412 : QObject(*(
new QQuickSwipeDelegateAttachedPrivate), object)
1414 QQuickItem *item = qobject_cast<QQuickItem *>(object);
1420 item->setAcceptedMouseButtons(Qt::AllButtons);
1422 qWarning() <<
"SwipeDelegate attached property must be attached to an object deriving from Item";
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
1509
1510
1511
1512bool QQuickSwipeDelegateAttached::isPressed()
const
1514 Q_D(
const QQuickSwipeDelegateAttached);
1518void QQuickSwipeDelegateAttached::setPressed(
bool pressed)
1520 Q_D(QQuickSwipeDelegateAttached);
1521 if (pressed == d->pressed)
1524 d->pressed = pressed;
1525 emit pressedChanged();
1530#include "moc_qquickswipe_p.cpp"
1531#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)