aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquickcontainer.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-26 17:38:57 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-27 10:27:35 +0000
commit4f2251caa995cab6b5231580b7b4c7e3be55ba14 (patch)
treec946be1bca61c582ee19aee2d6f61ec7aecb3c10 /src/templates/qquickcontainer.cpp
parent943dd6eadb207447d8eabe207f6d77494797a52c (diff)
TabBar: fix binding loop on currentIndex
TabBar is a container of exclusive items aka TabButtons. In this case we let ExclusiveGroup manage the currently checked item, and just sync the current index when appropriate. In the case of a SwipeView, which contains arbitrary non-checkable items, we track the current index of the content item. However, we should avoid doing both at the same time, because it leads to a race between content item's current index and exclusive group's current item. Change-Id: Ib2d4dfe0d22d883be49b03a3b2311bdea7d937d9 Task-number: QTBUG-48993 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/templates/qquickcontainer.cpp')
-rw-r--r--src/templates/qquickcontainer.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/templates/qquickcontainer.cpp b/src/templates/qquickcontainer.cpp
index 5bd3e8f3..ef08161f 100644
--- a/src/templates/qquickcontainer.cpp
+++ b/src/templates/qquickcontainer.cpp
@@ -515,17 +515,21 @@ void QQuickContainer::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem
if (oldItem) {
QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
- int signalIndex = oldItem->metaObject()->indexOfSignal("currentIndexChanged()");
- if (signalIndex != -1)
- QMetaObject::disconnect(oldItem, signalIndex, this, slotIndex);
+ if (!d->exclusiveGroup) {
+ int signalIndex = oldItem->metaObject()->indexOfSignal("currentIndexChanged()");
+ if (signalIndex != -1)
+ QMetaObject::disconnect(oldItem, signalIndex, this, slotIndex);
+ }
}
if (newItem) {
QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
- int signalIndex = newItem->metaObject()->indexOfSignal("currentIndexChanged()");
- if (signalIndex != -1)
- QMetaObject::connect(newItem, signalIndex, this, slotIndex);
+ if (!d->exclusiveGroup) {
+ int signalIndex = newItem->metaObject()->indexOfSignal("currentIndexChanged()");
+ if (signalIndex != -1)
+ QMetaObject::connect(newItem, signalIndex, this, slotIndex);
+ }
}
}