diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-22 11:38:23 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-06-22 14:25:26 +0000 |
commit | 1e8e2148059a83b17cc7c888364f4b27fb7b0391 (patch) | |
tree | 0480274291d70f6fb97065da7e904873d4879e18 /src/quicktemplates2/qquickswipeview.cpp | |
parent | d3b20ffdfa47229c90e856d6ef39723910ae612c (diff) |
Add SwipeView::interactive
[ChangeLog][SwipeView] Added interactive property for controlling
whether swipe interaction is enabled.
Task-number: QTBUG-54268
Change-Id: I1f03e4958defe52c8a15c808567424c85f07f8bd
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickswipeview.cpp')
-rw-r--r-- | src/quicktemplates2/qquickswipeview.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp index 29490643..06c9b5eb 100644 --- a/src/quicktemplates2/qquickswipeview.cpp +++ b/src/quicktemplates2/qquickswipeview.cpp @@ -106,10 +106,14 @@ class QQuickSwipeViewPrivate : public QQuickContainerPrivate Q_DECLARE_PUBLIC(QQuickSwipeView) public: + QQuickSwipeViewPrivate() : interactive(true) { } + void resizeItem(QQuickItem *item); void resizeItems(); static QQuickSwipeViewPrivate *get(QQuickSwipeView *view); + + bool interactive; }; void QQuickSwipeViewPrivate::resizeItems() @@ -143,6 +147,31 @@ QQuickSwipeView::QQuickSwipeView(QQuickItem *parent) : setActiveFocusOnTab(true); } +/*! + \since QtQuick.Controls 2.1 + \qmlproperty bool QtQuick.Controls::SwipeView::interactive + + This property describes whether the user can interact with the SwipeView. + The user cannot swipe a view that is not interactive. + + The default value is \c true. +*/ +bool QQuickSwipeView::isInteractive() const +{ + Q_D(const QQuickSwipeView); + return d->interactive; +} + +void QQuickSwipeView::setInteractive(bool interactive) +{ + Q_D(QQuickSwipeView); + if (d->interactive == interactive) + return; + + d->interactive = interactive; + emit interactiveChanged(); +} + QQuickSwipeViewAttached *QQuickSwipeView::qmlAttachedProperties(QObject *object) { QQuickItem *item = qobject_cast<QQuickItem *>(object); |