Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickswipedelegate_p.h
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKSWIPEDELEGATE_P_H
6#define QQUICKSWIPEDELEGATE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickitemdelegate_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QQuickSwipe;
25class QQuickSwipeDelegateAttached;
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickSwipeDelegate : public QQuickItemDelegate
29{
30 Q_OBJECT
31 Q_PROPERTY(QQuickSwipe *swipe READ swipe CONSTANT FINAL)
32 QML_NAMED_ELEMENT(SwipeDelegate)
33 QML_ATTACHED(QQuickSwipeDelegateAttached)
34 QML_ADDED_IN_VERSION(2, 0)
35
36public:
37 explicit QQuickSwipeDelegate(QQuickItem *parent = nullptr);
38
39 QQuickSwipe *swipe() const;
40
41 enum Side { Left = 1, Right = -1 };
42 Q_ENUM(Side)
43
44 static QQuickSwipeDelegateAttached *qmlAttachedProperties(QObject *object);
45
46protected:
47 bool childMouseEventFilter(QQuickItem *child, QEvent *event) override;
48 void mousePressEvent(QMouseEvent *event) override;
49 void mouseMoveEvent(QMouseEvent *event) override;
50 void mouseReleaseEvent(QMouseEvent *event) override;
51 void mouseUngrabEvent() override;
52 void touchEvent(QTouchEvent *event) override;
53
54 void componentComplete() override;
55 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
56
57 QFont defaultFont() const override;
58
59#if QT_CONFIG(accessibility)
60 QAccessible::Role accessibleRole() const override;
61#endif
62
63private:
64 Q_DISABLE_COPY(QQuickSwipeDelegate)
65 Q_DECLARE_PRIVATE(QQuickSwipeDelegate)
66};
67
68class Q_QUICKTEMPLATES2_EXPORT QQuickSwipeDelegateAttached : public QObject
69{
70 Q_OBJECT
71 Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
72
73public:
74 explicit QQuickSwipeDelegateAttached(QObject *object = nullptr);
75
76 bool isPressed() const;
77 void setPressed(bool pressed);
78
79Q_SIGNALS:
80 void pressedChanged();
81 void clicked();
82
83private:
84 Q_DISABLE_COPY(QQuickSwipeDelegateAttached)
85 Q_DECLARE_PRIVATE(QQuickSwipeDelegateAttached)
86};
87
88QT_END_NAMESPACE
89
90Q_DECLARE_METATYPE(QQuickSwipeDelegate::Side)
91
92#endif // QQUICKSWIPEDELEGATE_P_H
bool handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event)
void forwardMouseEvent(QMouseEvent *event, QQuickItem *destination, QPointF localPos)
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)
QQuickVelocityCalculator velocityCalculator
QQuickItem * showRelevantItemForPosition(qreal position)
QScopedPointer< QQuickSwipeTransitionManager > transitionManager
void reposition(PositionAnimation animationPolicy)
QQuickTransition * transition
QQuickItem * createDelegateItem(QQmlComponent *component)
QQuickItem * createRelevantItemForDistance(qreal distance)
void beginTransition(qreal position)
QQuickSwipeDelegate * control
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)