summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2014-08-27 08:17:54 +0200
committerJan Arve Sæther <jan-arve.saether@digia.com>2014-08-27 12:57:18 +0200
commit6c09c2142e7319d72593e7f9f5391352da0a0dee (patch)
tree8d1e0a806e5ca9185503c182ae95e5bd49068fd1
parent3f2dc4a8d4066b47e639ad8a36c1c2ac3c6d3f27 (diff)
downloadqtquickcontrols-6c09c2142e7319d72593e7f9f5391352da0a0dee.tar.gz
Children of ContentItem must be visible in order to be evaluated.
Task-number: QTBUG-38469 Change-Id: Ie097c0b59f3453de63cc3c997773289fbafde48f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
-rw-r--r--src/controls/Private/ContentItem.qml2
-rw-r--r--tests/auto/controls/data/tst_applicationwindow.qml24
2 files changed, 25 insertions, 1 deletions
diff --git a/src/controls/Private/ContentItem.qml b/src/controls/Private/ContentItem.qml
index 1e386424..856dff84 100644
--- a/src/controls/Private/ContentItem.qml
+++ b/src/controls/Private/ContentItem.qml
@@ -51,7 +51,7 @@ Item {
implicitHeight: __calcImplicitHeight()
/*! \internal */
- property Item __layoutItem: contentItem.children.length === 1 ? contentItem.children[0] : null
+ property Item __layoutItem: contentItem.visibleChildren.length === 1 ? contentItem.visibleChildren[0] : null
/*! \internal */
property real __marginsWidth: __layoutItem ? __layoutItem.anchors.leftMargin + __layoutItem.anchors.rightMargin : 0
/*! \internal */
diff --git a/tests/auto/controls/data/tst_applicationwindow.qml b/tests/auto/controls/data/tst_applicationwindow.qml
index 85c88ece..72dfb1cd 100644
--- a/tests/auto/controls/data/tst_applicationwindow.qml
+++ b/tests/auto/controls/data/tst_applicationwindow.qml
@@ -236,5 +236,29 @@ TestCase {
window.destroy()
}
+ function test_invisibleContentItemChildren() {
+ var test_control = 'import QtQuick 2.2; \
+ import QtQuick.Controls 1.2; \
+ ApplicationWindow { \
+ Rectangle { \
+ visible: false; \
+ implicitWidth: 400; \
+ implicitHeight: 400; \
+ } \
+ Rectangle { \
+ anchors.fill: parent; \
+ implicitWidth: 300; \
+ implicitHeight: 300; \
+ } \
+ } '
+
+ var window = Qt.createQmlObject(test_control, container, '')
+ window.visible = true
+ waitForRendering(window.contentItem)
+ compare(window.width, 300)
+ compare(window.height, 300)
+ window.destroy()
+ }
+
}
}