summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()
+ }
+
}
}