diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2013-03-22 16:14:33 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-22 22:20:38 +0100 |
commit | a85e24a07486a7b36b9593911564b015cc609a81 (patch) | |
tree | b4f8b02ff3c2bc925a0a8d5c6f48a383e34fe372 /src/controls/GroupBox.qml | |
parent | ee0303b00b238f65e47d692e61a0b68195e89c02 (diff) |
Improve GroupBox styling and content calculation
We need this to have expanding layouts.
Change-Id: I32ef9da90fa9210febaa23d3f579ec94f03c377d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/controls/GroupBox.qml')
-rw-r--r-- | src/controls/GroupBox.qml | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/controls/GroupBox.qml b/src/controls/GroupBox.qml index b97ee18b4..36b86fc35 100644 --- a/src/controls/GroupBox.qml +++ b/src/controls/GroupBox.qml @@ -130,18 +130,15 @@ Item { /*! This property holds the width of the content. */ - readonly property real contentWidth: content.childrenRect.width + 2 * __margin + property real contentWidth: content.childrenRect.width /*! This property holds the height of the content. */ - readonly property real contentHeight: content.childrenRect.height + 2 * __margin + property real contentHeight: content.childrenRect.height /*! \internal */ - property int __margin: 8 - - /*! \internal */ - property Component style: Qt.createComponent(Settings.THEME_PATH + "/GroupBoxStyle.qml", groupbox) + property Component __style: Qt.createComponent(Settings.THEME_PATH + "/GroupBoxStyle.qml", groupbox) /*! \internal */ default property alias data: content.data @@ -161,12 +158,16 @@ Item { id: loader property alias control: groupbox anchors.fill: parent - property int topMargin: (title.length > 0 || checkable ? 16 : 0) + __margin + property int topMargin: (title.length > 0 || checkable ? 16 : 0) + content.margin property int bottomMargin: 4 property int leftMargin: 4 property int rightMargin: 4 - sourceComponent: style + sourceComponent: styleLoader.item ? styleLoader.item.panel : null onLoaded: item.z = -1 + Loader { + id: styleLoader + sourceComponent: __style + } } CheckBox { @@ -185,10 +186,11 @@ Item { id:content z: 1 focus: true + property int margin: styleLoader.item ? styleLoader.item.margin : 0 anchors.topMargin: loader.topMargin - anchors.leftMargin: __margin - anchors.rightMargin: __margin - anchors.bottomMargin: __margin + anchors.leftMargin: margin + anchors.rightMargin: margin + anchors.bottomMargin: margin anchors.fill: parent enabled: (!groupbox.checkable || groupbox.checked) } |