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
qquickswipeview_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 QQUICKSWIPEVIEW_P_H
6#define QQUICKSWIPEVIEW_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/qquickcontainer_p.h>
20
22
23QT_BEGIN_NAMESPACE
24
25class QQuickSwipeViewAttached;
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickSwipeView : public QQuickContainer
29{
30 Q_OBJECT
31 // 2.1 (Qt 5.8)
32 Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged FINAL REVISION(2, 1))
33 // 2.2 (Qt 5.9)
34 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL REVISION(2, 2))
35 // 2.3 (Qt 5.10)
36 Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION(2, 3))
37 Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION(2, 3))
38 QML_NAMED_ELEMENT(SwipeView)
39 QML_ATTACHED(QQuickSwipeViewAttached)
40 QML_ADDED_IN_VERSION(2, 0)
41
42public:
43 explicit QQuickSwipeView(QQuickItem *parent = nullptr);
44
45 static QQuickSwipeViewAttached *qmlAttachedProperties(QObject *object);
46
47 // 2.1 (Qt 5.8)
48 bool isInteractive() const;
49 void setInteractive(bool interactive);
50
51 // 2.2 (Qt 5.9)
52 Qt::Orientation orientation() const;
53 void setOrientation(Qt::Orientation orientation);
54
55 // 2.3 (Qt 5.10)
56 bool isHorizontal() const;
57 bool isVertical() const;
58
59Q_SIGNALS:
60 // 2.1 (Qt 5.8)
61 Q_REVISION(2, 1) void interactiveChanged();
62 // 2.2 (Qt 5.9)
63 Q_REVISION(2, 2) void orientationChanged();
64
65protected:
66 void componentComplete() override;
67 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
68 void itemAdded(int index, QQuickItem *item) override;
69 void itemMoved(int index, QQuickItem *item) override;
70 void itemRemoved(int index, QQuickItem *item) override;
71
72#if QT_CONFIG(accessibility)
73 QAccessible::Role accessibleRole() const override;
74#endif
75
76private:
77 Q_DISABLE_COPY(QQuickSwipeView)
78 Q_DECLARE_PRIVATE(QQuickSwipeView)
79};
80
82
83class Q_QUICKTEMPLATES2_EXPORT QQuickSwipeViewAttached : public QObject
84{
85 Q_OBJECT
86 Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
87 Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY isCurrentItemChanged FINAL)
88 Q_PROPERTY(QQuickSwipeView *view READ view NOTIFY viewChanged FINAL)
89 // 2.1 (Qt 5.8)
90 Q_PROPERTY(bool isNextItem READ isNextItem NOTIFY isNextItemChanged FINAL REVISION(2, 1))
91 Q_PROPERTY(bool isPreviousItem READ isPreviousItem NOTIFY isPreviousItemChanged FINAL REVISION(2, 1))
92
93public:
94 explicit QQuickSwipeViewAttached(QObject *parent = nullptr);
95
96 int index() const;
97 bool isCurrentItem() const;
98 QQuickSwipeView *view() const;
99
100 // 2.1 (Qt 5.8)
101 bool isNextItem() const;
102 bool isPreviousItem() const;
103
104Q_SIGNALS:
105 void indexChanged();
106 void isCurrentItemChanged();
107 void viewChanged();
108 // 2.1 (Qt 5.8)
109 /*Q_REVISION(2, 1)*/ void isNextItemChanged();
110 /*Q_REVISION(2, 1)*/ void isPreviousItemChanged();
111
112private:
113 Q_DISABLE_COPY(QQuickSwipeViewAttached)
114 Q_DECLARE_PRIVATE(QQuickSwipeViewAttached)
115};
116
117QT_END_NAMESPACE
118
119#endif // QQUICKSWIPEVIEW_P_H
void updateCurrentIndex()
\qmlattachedproperty int QtQuick.Controls::SwipeView::index \readonly
Enables the user to navigate pages by swiping sideways.
void itemImplicitWidthChanged(QQuickItem *item) override
qreal getContentHeight() const override
qreal getContentWidth() const override
static QQuickSwipeViewPrivate * get(QQuickSwipeView *view)
Qt::Orientation orientation
void itemImplicitHeightChanged(QQuickItem *item) override
QT_REQUIRE_CONFIG(quicktemplates2_container)