From 437ab84c535538abc7adaa88b3101acdb98d2dde Mon Sep 17 00:00:00 2001
From: J-P Nurmi <jpnurmi@theqtcompany.com>
Date: Wed, 15 Oct 2014 17:10:09 +0200
Subject: [PATCH] Android: fix GroupBoxStyle top margin

GroupBoxStyle was using checkmark indicator's height even when
the GroupBox was not checkable => too much spacing.

Change-Id: Ic68d8428471b8835cd92f44610a0d8b281bcc734
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
---
 src/controls/Styles/Android/GroupBoxStyle.qml | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/controls/Styles/Android/GroupBoxStyle.qml b/src/controls/Styles/Android/GroupBoxStyle.qml
index b7346ea43..d8f1127b6 100644
--- a/src/controls/Styles/Android/GroupBoxStyle.qml
+++ b/src/controls/Styles/Android/GroupBoxStyle.qml
@@ -53,7 +53,7 @@ GroupBoxStyle {
         readonly property var styleDef: AndroidStyle.styleDef.checkboxStyle
 
         readonly property real contentMargin: label.implicitHeight / 3
-        readonly property real topMargin: indicator.height
+        readonly property real topMargin: control.checkable ? indicator.height : label.height
         Binding { target: root; property: "padding.top"; value: topMargin + contentMargin }
         Binding { target: root; property: "padding.left"; value: contentMargin }
         Binding { target: root; property: "padding.right"; value: contentMargin }
@@ -95,14 +95,15 @@ GroupBoxStyle {
 
         DrawableLoader {
             id: indicator
-            visible: control.checkable
+            active: control.checkable
             checked: control.checked
             pressed: check.pressed
             focused: check.activeFocus
             window_focused: control.Window.active
             styleDef: AndroidStyle.styleDef.checkboxStyle.CompoundButton_button
-            anchors.verticalCenter: label.verticalCenter
             width: control.checkable ? item.implicitWidth : 0
+            anchors.verticalCenter: parent.top
+            anchors.verticalCenterOffset: topMargin / 2
         }
 
         LabelStyle {
@@ -114,9 +115,10 @@ GroupBoxStyle {
             window_focused: control.Window.active
             styleDef: AndroidStyle.styleDef.checkboxStyle
 
-            anchors.top: parent.top
             anchors.left: indicator.right
             anchors.right: parent.right
+            anchors.verticalCenter: parent.top
+            anchors.verticalCenterOffset: topMargin / 2
         }
     }
 }
-- 
GitLab