From bcf132fb54b4b1c9ba3ade31c134a521b361ab62 Mon Sep 17 00:00:00 2001
From: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Date: Mon, 27 May 2013 10:57:10 +0200
Subject: [PATCH] Pixel adjustment on mac

Made the SpinBox and TextField 22 px on mac. Fixed internal
offset.

Change-Id: I36964048415dfedb3db0fac65fb8c1b710ea226f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
---
 src/private/qquickstyleitem.cpp     | 4 ++--
 src/styles/Desktop/SpinBoxStyle.qml | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/private/qquickstyleitem.cpp b/src/private/qquickstyleitem.cpp
index f5e32bba4..cfbb36c89 100644
--- a/src/private/qquickstyleitem.cpp
+++ b/src/private/qquickstyleitem.cpp
@@ -794,7 +794,7 @@ QSize QQuickStyleItem::sizeFromContents(int width, int height)
     case SpinBox:
 #ifdef Q_OS_MAC
         if (style() == "mac") {
-            size = qApp->style()->sizeFromContents(QStyle::CT_SpinBox, m_styleoption, QSize(width, height + 4));
+            size = qApp->style()->sizeFromContents(QStyle::CT_SpinBox, m_styleoption, QSize(width, height + 5));
             break;
         }
 #endif // fall trough if not mac
@@ -804,7 +804,7 @@ QSize QQuickStyleItem::sizeFromContents(int width, int height)
             if (m_hints.indexOf("small") != -1 || m_hints.indexOf("mini") != -1)
                 size = QSize(width, 19);
             else
-                size = QSize(width, 21);
+                size = QSize(width, 22);
         } else
 #endif
         {
diff --git a/src/styles/Desktop/SpinBoxStyle.qml b/src/styles/Desktop/SpinBoxStyle.qml
index 227a6e7c2..2da3db1f2 100644
--- a/src/styles/Desktop/SpinBoxStyle.qml
+++ b/src/styles/Desktop/SpinBoxStyle.qml
@@ -50,7 +50,7 @@ PaddedStyle {
     }
 
     padding {
-       top: control.__panel ? control.__panel.topPadding : 0
+       top: control.__panel ? control.__panel.topPadding + (control.__panel.style === "mac" ? 1 : 0) : 0
        left: control.__panel ? control.__panel.leftPadding : 0
        right: control.__panel ? control.__panel.rightPadding : 0
        bottom: control.__panel ? control.__panel.bottomPadding : 0
@@ -100,7 +100,7 @@ PaddedStyle {
             style.upRect = styleitem.subControlRect("up");
             style.downRect = styleitem.subControlRect("down");
             var inputRect = styleitem.subControlRect("edit");
-            edit.anchors.topMargin = inputRect.y + (styleitem.style === "mac" ? 1 : 0)
+            edit.anchors.topMargin = inputRect.y
             edit.anchors.leftMargin = inputRect.x
             edit.anchors.rightMargin = style.width - inputRect.width - edit.anchors.leftMargin
             edit.anchors.bottomMargin = style.height - inputRect.height - edit.anchors.topMargin
-- 
GitLab