diff options
Diffstat (limited to 'src/controls/GroupBox.qml')
-rw-r--r-- | src/controls/GroupBox.qml | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/controls/GroupBox.qml b/src/controls/GroupBox.qml index e358dd9d..4aa6a50f 100644 --- a/src/controls/GroupBox.qml +++ b/src/controls/GroupBox.qml @@ -159,7 +159,8 @@ Item { /*! \internal */ property alias __style: styleLoader.item - implicitWidth: (!anchors.fill ? container.calcWidth() : 0) + loader.leftMargin + loader.rightMargin + implicitWidth: Math.max((!anchors.fill ? container.calcWidth() : 0) + loader.leftMargin + loader.rightMargin, + sizeHint.implicitWidth + (checkable ? 24 : 6)) implicitHeight: (!anchors.fill ? container.calcHeight() : 0) + loader.topMargin + loader.bottomMargin Layout.minimumWidth: implicitWidth @@ -181,6 +182,7 @@ Item { property int rightMargin: __style ? __style.padding.right : 0 sourceComponent: styleLoader.item ? styleLoader.item.panel : null onLoaded: item.z = -1 + Text { id: sizeHint ; visible: false ; text: title } Loader { id: styleLoader property alias __control: groupbox @@ -212,7 +214,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) } }] } |