From 01054603a797805cc5c18c65aed7f0f192b68851 Mon Sep 17 00:00:00 2001
From: Marko Kangas <marko.kangas@digia.com>
Date: Thu, 23 Oct 2014 10:27:02 +0300
Subject: [PATCH] Fix tab icon vertical alignment

Fixes case if custom icon size is given and height is more than width.
Check of minimum valid height was compared wrongly to width and caused invalid
vertical alignment. After fix vertical alignment is correct aligned to vertical
center with the tab text.

Change-Id: I6c4a710b15e91225edeabb629bfea7049ab2f42a
Task-number: QTBUG-42143
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Jens Bache-Wiig <jensbw@gmail.com>
---
 src/widgets/styles/qcommonstyle.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 85793088209..1c5dcf5f0aa 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1114,7 +1114,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget
                         (opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled,
                         (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off  );
         // High-dpi icons do not need adjustmet; make sure tabIconSize is not larger than iconSize
-        tabIconSize = QSize(qMin(tabIconSize.width(), iconSize.width()), qMin(tabIconSize.height(), iconSize.width()));
+        tabIconSize = QSize(qMin(tabIconSize.width(), iconSize.width()), qMin(tabIconSize.height(), iconSize.height()));
 
         *iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2,
                     tabIconSize.width(), tabIconSize .height());
-- 
GitLab