From 10458b3d4dc1ed9f06eece9d61d2e699e602117d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 5 Dec 2015 12:35:08 +0100 Subject: GroupBox: add an example of a checkable groupbox Adjust the size calculation so that the example works smooth. Change-Id: Iaf25107b0cfaa3ceef0caeba120d1bd74c9bc854 Reviewed-by: Mitch Curtis --- src/imports/controls/GroupBox.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/imports/controls/GroupBox.qml') diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml index 8504fae9..08866606 100644 --- a/src/imports/controls/GroupBox.qml +++ b/src/imports/controls/GroupBox.qml @@ -40,7 +40,9 @@ import Qt.labs.templates 1.0 as T T.GroupBox { id: control - implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) + implicitWidth: Math.max(background ? background.implicitWidth : 0, + label ? label.implicitWidth + leftPadding + rightPadding : 0, + contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0 @@ -48,7 +50,7 @@ T.GroupBox { spacing: 6 padding: 6 - topPadding: 6 + (label && title ? label.implicitHeight + spacing : 0) + topPadding: 6 + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0) //! [contentItem] contentItem: Item { } -- cgit v1.2.3