1/****************************************************************************
2**
3** Copyright (C) 2017 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL3$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or later as published by the Free
28** Software Foundation and appearing in the file LICENSE.GPL included in
29** the packaging of this file. Please review the following information to
30** ensure the GNU General Public License version 2.0 requirements will be
31** met: http://www.gnu.org/licenses/gpl-2.0.html.
32**
33** $QT_END_LICENSE$
34**
35****************************************************************************/
36
37#ifndef QQUICKSWIPEVIEW_P_H
38#define QQUICKSWIPEVIEW_P_H
39
40//
41// W A R N I N G
42// -------------
43//
44// This file is not part of the Qt API. It exists purely as an
45// implementation detail. This header file may change from version to
46// version without notice, or even be removed.
47//
48// We mean it.
49//
50
51#include <QtQuickTemplates2/private/qquickcontainer_p.h>
52
53QT_BEGIN_NAMESPACE
54
55class QQuickSwipeViewAttached;
56class QQuickSwipeViewPrivate;
57
58class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeView : public QQuickContainer
59{
60 Q_OBJECT
61 // 2.1 (Qt 5.8)
62 Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged FINAL REVISION 1)
63 // 2.2 (Qt 5.9)
64 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL REVISION 2)
65 // 2.3 (Qt 5.10)
66 Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
67 Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
68
69public:
70 explicit QQuickSwipeView(QQuickItem *parent = nullptr);
71
72 static QQuickSwipeViewAttached *qmlAttachedProperties(QObject *object);
73
74 // 2.1 (Qt 5.8)
75 bool isInteractive() const;
76 void setInteractive(bool interactive);
77
78 // 2.2 (Qt 5.9)
79 Qt::Orientation orientation() const;
80 void setOrientation(Qt::Orientation orientation);
81
82 // 2.3 (Qt 5.10)
83 bool isHorizontal() const;
84 bool isVertical() const;
85
86Q_SIGNALS:
87 // 2.1 (Qt 5.8)
88 Q_REVISION(1) void interactiveChanged();
89 // 2.2 (Qt 5.9)
90 Q_REVISION(2) void orientationChanged();
91
92protected:
93 void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
94 void itemAdded(int index, QQuickItem *item) override;
95 void itemMoved(int index, QQuickItem *item) override;
96 void itemRemoved(int index, QQuickItem *item) override;
97
98#if QT_CONFIG(accessibility)
99 QAccessible::Role accessibleRole() const override;
100#endif
101
102private:
103 Q_DISABLE_COPY(QQuickSwipeView)
104 Q_DECLARE_PRIVATE(QQuickSwipeView)
105};
106
107class QQuickSwipeViewAttachedPrivate;
108
109class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeViewAttached : public QObject
110{
111 Q_OBJECT
112 Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
113 Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY isCurrentItemChanged FINAL)
114 Q_PROPERTY(QQuickSwipeView *view READ view NOTIFY viewChanged FINAL)
115 // 2.1 (Qt 5.8)
116 Q_PROPERTY(bool isNextItem READ isNextItem NOTIFY isNextItemChanged FINAL REVISION 1)
117 Q_PROPERTY(bool isPreviousItem READ isPreviousItem NOTIFY isPreviousItemChanged FINAL REVISION 1)
118
119public:
120 explicit QQuickSwipeViewAttached(QObject *parent = nullptr);
121
122 int index() const;
123 bool isCurrentItem() const;
124 QQuickSwipeView *view() const;
125
126 // 2.1 (Qt 5.8)
127 bool isNextItem() const;
128 bool isPreviousItem() const;
129
130Q_SIGNALS:
131 void indexChanged();
132 void isCurrentItemChanged();
133 void viewChanged();
134 // 2.1 (Qt 5.8)
135 /*Q_REVISION(1)*/ void isNextItemChanged();
136 /*Q_REVISION(1)*/ void isPreviousItemChanged();
137
138private:
139 Q_DISABLE_COPY(QQuickSwipeViewAttached)
140 Q_DECLARE_PRIVATE(QQuickSwipeViewAttached)
141};
142
143QT_END_NAMESPACE
144
145QML_DECLARE_TYPE(QQuickSwipeView)
146QML_DECLARE_TYPEINFO(QQuickSwipeView, QML_HAS_ATTACHED_PROPERTIES)
147
148#endif // QQUICKSWIPEVIEW_P_H
149

source code of qtquickcontrols2/src/quicktemplates2/qquickswipeview_p.h