From 9a65b10e827b9bb09911feb9bd06ed10312463fc Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 16 Dec 2015 16:34:34 +0100 Subject: Fix StackView resizing Change-Id: Ib09996a9f12b669ae10fb7197f1e5b443540f7b0 Reviewed-by: J-P Nurmi --- src/templates/qquickstackview.cpp | 9 ++------- src/templates/qquickstackview_p.cpp | 10 +++------- src/templates/qquickstackview_p_p.h | 2 ++ 3 files changed, 7 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/templates/qquickstackview.cpp b/src/templates/qquickstackview.cpp index 2dcae1a1..8ce04b30 100644 --- a/src/templates/qquickstackview.cpp +++ b/src/templates/qquickstackview.cpp @@ -870,15 +870,10 @@ void QQuickStackView::geometryChanged(const QRectF &newGeometry, const QRectF &o Q_D(QQuickStackView); foreach (QQuickStackElement *element, d->elements) { if (element->item) { - QQuickItemPrivate *p = QQuickItemPrivate::get(element->item); - if (!p->widthValid) { + if (!element->widthValid) element->item->setWidth(newGeometry.width()); - p->widthValid = false; - } - if (!p->heightValid) { + if (!element->heightValid) element->item->setHeight(newGeometry.height()); - p->heightValid = false; - } } } } diff --git a/src/templates/qquickstackview_p.cpp b/src/templates/qquickstackview_p.cpp index 92bfcbf4..06c605d2 100644 --- a/src/templates/qquickstackview_p.cpp +++ b/src/templates/qquickstackview_p.cpp @@ -69,7 +69,7 @@ private: }; QQuickStackElement::QQuickStackElement() : QQuickItemViewTransitionableItem(Q_NULLPTR), - index(-1), init(false), removal(false), ownItem(false), ownComponent(false), + index(-1), init(false), removal(false), ownItem(false), ownComponent(false), widthValid(false), heightValid(false), context(Q_NULLPTR), component(Q_NULLPTR), incubator(Q_NULLPTR), view(Q_NULLPTR), status(QQuickStackView::Inactive) { @@ -162,14 +162,10 @@ void QQuickStackElement::initialize() return; QQuickItemPrivate *p = QQuickItemPrivate::get(item); - if (!p->widthValid) { + if (!(widthValid = p->widthValid)) item->setWidth(view->width()); - p->widthValid = false; - } - if (!p->heightValid) { + if (!(heightValid = p->heightValid)) item->setHeight(view->height()); - p->heightValid = false; - } item->setParentItem(view); p->addItemChangeListener(this, QQuickItemPrivate::Destroyed); diff --git a/src/templates/qquickstackview_p_p.h b/src/templates/qquickstackview_p_p.h index 94919939..d37334d8 100644 --- a/src/templates/qquickstackview_p_p.h +++ b/src/templates/qquickstackview_p_p.h @@ -89,6 +89,8 @@ public: bool removal; bool ownItem; bool ownComponent; + bool widthValid; + bool heightValid; QQmlContext *context; QQmlComponent *component; QQmlIncubator *incubator; -- cgit v1.2.3