diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-12-05 12:35:08 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-12-09 16:27:00 +0000 |
commit | 10458b3d4dc1ed9f06eece9d61d2e699e602117d (patch) | |
tree | bdffb6b584965cbe8a03d4dffea2097201bddefe /src/imports/controls/GroupBox.qml | |
parent | f2f9786e6194725bf48ee3833b1fdf9603b74e69 (diff) |
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 <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/GroupBox.qml')
-rw-r--r-- | src/imports/controls/GroupBox.qml | 6 |
1 files changed, 4 insertions, 2 deletions
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 { } |