aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-26 17:30:24 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-27 10:27:32 +0000
commit943dd6eadb207447d8eabe207f6d77494797a52c (patch)
tree6bd3668d3519571ad7bd971915fd48e1993f76e8 /src
parent1d305ebf16d465b65dded01260845460ec06e40b (diff)
TabBar: fix the default layouting of dynamically added tabs
countChanged() used to be connected to updateLayout(), but this went missing somewhere around 73f931a7. Now we have the itemAdded() and itemRemoved() hooks that allow us to do the same more efficiently. Change-Id: I8a3eefb61555358d63fae63d066851038e332233 Task-number: QTBUG-48993 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/templates/qquicktabbar.cpp16
-rw-r--r--src/templates/qquicktabbar_p.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/templates/qquicktabbar.cpp b/src/templates/qquicktabbar.cpp
index 15564184..e72a0933 100644
--- a/src/templates/qquicktabbar.cpp
+++ b/src/templates/qquicktabbar.cpp
@@ -122,4 +122,20 @@ void QQuickTabBar::geometryChanged(const QRectF &newGeometry, const QRectF &oldG
d->updateLayout();
}
+void QQuickTabBar::itemAdded(int index, QQuickItem *item)
+{
+ Q_UNUSED(index);
+ Q_UNUSED(item);
+ if (isComponentComplete())
+ polish();
+}
+
+void QQuickTabBar::itemRemoved(int index, QQuickItem *item)
+{
+ Q_UNUSED(index);
+ Q_UNUSED(item);
+ if (isComponentComplete())
+ polish();
+}
+
QT_END_NAMESPACE
diff --git a/src/templates/qquicktabbar_p.h b/src/templates/qquicktabbar_p.h
index e711d10f..d5e3c70d 100644
--- a/src/templates/qquicktabbar_p.h
+++ b/src/templates/qquicktabbar_p.h
@@ -65,6 +65,8 @@ protected:
void updatePolish() Q_DECL_OVERRIDE;
void componentComplete() Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void itemAdded(int index, QQuickItem *item) Q_DECL_OVERRIDE;
+ void itemRemoved(int index, QQuickItem *item) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QQuickTabBar)