aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquickcontainer_p.h
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-21 14:58:38 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-22 14:42:22 +0000
commit8652098027b59edaf51f1779a7d575da931061c7 (patch)
treea742a9f82a167f5de98e9ac54263a7ea0f7b4d5a /src/templates/qquickcontainer_p.h
parente3bf4f771458590dd003fc710803c1c1babea68e (diff)
Move the internal ExclusiveGroup from TabBar to Container
TabBar needs to support PathView as a content item (for the Universal style). PathView creates a highlight item, which wrongly ends up being added as a content child. It shows up as an extra empty TabBar item, and leads to a warning from ExclusiveGroup::addCheckable(). An exclusive group instance is lazily created only for those containers that need it. This allows us to simplify the virtual hooks for added and removed items, whereas otherwise we would had had to add more complex hooks (before _and_ after adding an item) to be able to control/ignore the highlight somehow from the TabBar subclass. Change-Id: I2c35a1dd80541bc6b30e713a760277940a5486ed Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/templates/qquickcontainer_p.h')
-rw-r--r--src/templates/qquickcontainer_p.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/templates/qquickcontainer_p.h b/src/templates/qquickcontainer_p.h
index 52bc631c..2ce573b1 100644
--- a/src/templates/qquickcontainer_p.h
+++ b/src/templates/qquickcontainer_p.h
@@ -64,6 +64,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickContainer : public QQuickControl
Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
+ Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive NOTIFY exclusiveChanged FINAL)
Q_CLASSINFO("DefaultProperty", "contentData")
public:
@@ -84,6 +85,9 @@ public:
int currentIndex() const;
QQuickItem *currentItem() const;
+ bool isExclusive() const;
+ void setExclusive(bool exclusive);
+
public Q_SLOTS:
void setCurrentIndex(int index);
@@ -92,6 +96,7 @@ Q_SIGNALS:
void contentChildrenChanged();
void currentIndexChanged();
void currentItemChanged();
+ void exclusiveChanged();
protected:
QQuickContainer(QQuickContainerPrivate &dd, QQuickItem *parent);
@@ -102,6 +107,7 @@ protected:
private:
Q_DISABLE_COPY(QQuickContainer)
Q_DECLARE_PRIVATE(QQuickContainer)
+ Q_PRIVATE_SLOT(d_func(), void _q_currentItemChanged())
Q_PRIVATE_SLOT(d_func(), void _q_currentIndexChanged())
};