summaryrefslogtreecommitdiffstats
path: root/src/controls/GroupBox.qml
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-05-27 15:51:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-27 16:02:55 +0200
commitdbf42fc0028acc0170bb0d0dad966c74b86a456e (patch)
treeaad81f2778a9be29e3630f7f21b0a3d1952546a6 /src/controls/GroupBox.qml
parentd3e9b0e8e0ee822e02e3e89d4e890de4ed0ffcd4 (diff)
Make GroupBox size respect anchor margins and update Gallery
We now implicitly add the margins to GroupBox so that you can easily add them to a layout. This also gets rid of the silly Sidebar example and adds a much more useful Layout tab for effective testing. Change-Id: I6026c32b2a198062d9b11a67245df0529aa61f8a Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/controls/GroupBox.qml')
-rw-r--r--src/controls/GroupBox.qml8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/controls/GroupBox.qml b/src/controls/GroupBox.qml
index e358dd9d0..9bf1c0cc5 100644
--- a/src/controls/GroupBox.qml
+++ b/src/controls/GroupBox.qml
@@ -212,7 +212,11 @@ Item {
enabled: (!groupbox.checkable || groupbox.checked)
property Item layoutItem: container.children.length === 1 ? container.children[0] : null
- function calcWidth () { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) : container.childrenRect.width) }
- function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) : container.childrenRect.height) }
+ function calcWidth () { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) : container.childrenRect.width) }
+ function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+ layoutItem.anchors.bottomMargin : 0) : container.childrenRect.height) }
}]
}