summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-01-23 12:02:27 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-01-23 11:59:40 +0000
commit29c0ac9a950d063e627a077189b33aaf4810cf89 (patch)
tree80ec239b3b83f26bf0463617b8ae72774714e16b
parent69eaa4052c5d5e8f4ac2f87e2ef3362c5d429e64 (diff)
Fix resizing of implicitly created content items
Pane, Frame, and other container type of controls create their default content item lazily (commit 0e3636a). Under certain circumstances, the default content item was not resized as appropriate. Change-Id: Ia1f55030f62cc7b02c5bc770b4983f1240acf42d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp1
-rw-r--r--tests/auto/controls/data/tst_pane.qml12
2 files changed, 13 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 6a9d4eb3..a8f4b952 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -1180,6 +1180,7 @@ void QQuickControl::componentComplete()
{
Q_D(QQuickControl);
QQuickItem::componentComplete();
+ d->resizeContent();
if (!d->hasLocale)
d->locale = QQuickControlPrivate::calcLocale(d->parentItem);
if (!d->explicitHoverEnabled)
diff --git a/tests/auto/controls/data/tst_pane.qml b/tests/auto/controls/data/tst_pane.qml
index ec188afb..a8d901e7 100644
--- a/tests/auto/controls/data/tst_pane.qml
+++ b/tests/auto/controls/data/tst_pane.qml
@@ -149,6 +149,18 @@ TestCase {
control.destroy()
}
+ function test_implicitContentItem() {
+ var control = pane.createObject(testCase, {width: 100, height: 100})
+ verify(control)
+
+ compare(control.width, 100)
+ compare(control.height, 100)
+ compare(control.contentItem.width, control.availableWidth)
+ compare(control.contentItem.height, control.availableHeight)
+
+ control.destroy()
+ }
+
function test_press() {
var control = pressPane.createObject(testCase)
verify(control)