aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquickswipeview.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-21 14:31:04 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-22 11:16:25 +0000
commit4149f666e3b4ba5f2aed4a185a9d524d4e8247d0 (patch)
treeb6162c132410a0cca0362c5d90cdb69242b86219 /src/templates/qquickswipeview.cpp
parentbc546e14688c7056ac36b6f478fde852b5afaf46 (diff)
Promote current index handling from SwipeView to Container
Change-Id: I845b0999aaf9c211447c83bed2103de898c30b3f Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/templates/qquickswipeview.cpp')
-rw-r--r--src/templates/qquickswipeview.cpp38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/templates/qquickswipeview.cpp b/src/templates/qquickswipeview.cpp
index 083ee617..381f064d 100644
--- a/src/templates/qquickswipeview.cpp
+++ b/src/templates/qquickswipeview.cpp
@@ -75,18 +75,12 @@ class QQuickSwipeViewPrivate : public QQuickContainerPrivate
Q_DECLARE_PUBLIC(QQuickSwipeView)
public:
- QQuickSwipeViewPrivate() : updatingCurrent(false) { }
-
void resizeItem(QQuickItem *item);
void resizeItems();
- void _q_updateCurrent();
void itemInserted(int index, QQuickItem *item) Q_DECL_OVERRIDE;
- void itemMoved(int from, int to) Q_DECL_OVERRIDE;
static QQuickSwipeViewPrivate *get(QQuickSwipeView *view);
-
- bool updatingCurrent;
};
void QQuickSwipeViewPrivate::resizeItems()
@@ -100,13 +94,6 @@ void QQuickSwipeViewPrivate::resizeItems()
}
}
-void QQuickSwipeViewPrivate::_q_updateCurrent()
-{
- Q_Q(QQuickSwipeView);
- if (!updatingCurrent)
- q->setCurrentIndex(contentItem ? contentItem->property("currentIndex").toInt() : -1);
-}
-
void QQuickSwipeViewPrivate::itemInserted(int, QQuickItem *item)
{
Q_Q(QQuickSwipeView);
@@ -114,20 +101,6 @@ void QQuickSwipeViewPrivate::itemInserted(int, QQuickItem *item)
item->setSize(QSizeF(contentItem->width(), contentItem->height()));
}
-void QQuickSwipeViewPrivate::itemMoved(int from, int to)
-{
- Q_Q(QQuickSwipeView);
- updatingCurrent = true;
- if (from == currentIndex)
- q->setCurrentIndex(to);
- else if (from < currentIndex && to >= currentIndex)
- q->setCurrentIndex(currentIndex - 1);
- else if (from > currentIndex && to <= currentIndex)
- q->setCurrentIndex(currentIndex + 1);
- updatingCurrent = false;
-}
-
-
QQuickSwipeViewPrivate *QQuickSwipeViewPrivate::get(QQuickSwipeView *view)
{
return view->d_func();
@@ -158,15 +131,6 @@ void QQuickSwipeView::geometryChanged(const QRectF &newGeometry, const QRectF &o
d->resizeItems();
}
-void QQuickSwipeView::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- QQuickContainer::contentItemChange(newItem, oldItem);
- if (oldItem)
- disconnect(oldItem, SIGNAL(currentIndexChanged()), this, SLOT(_q_updateCurrent()));
- if (newItem)
- connect(newItem, SIGNAL(currentIndexChanged()), this, SLOT(_q_updateCurrent()));
-}
-
/*!
\qmlattachedproperty int Qt.labs.controls::SwipeView::index
@@ -361,5 +325,3 @@ bool QQuickSwipeViewAttached::isCurrentItem() const
}
QT_END_NAMESPACE
-
-#include "moc_qquickswipeview_p.cpp"