From 4387c5d6af49976318f7ca04c7a47b81a9cb19cc Mon Sep 17 00:00:00 2001
From: J-P Nurmi <jpnurmi@theqtcompany.com>
Date: Thu, 30 Oct 2014 12:39:10 +0100
Subject: [PATCH] QWindowsStyle: fix CE_ComboBoxLabel text color

CE_ComboBoxLabel was relying on a font color / painter pen set
by CC_ComboBox. This change ensures that CE_ComboBoxLabel has
correct color when CC_ComboBox and CE_ComboBoxLabel are drawn
independently.

Change-Id: Id548d831fdde5885bc7c157d55de6235ef3f0a56
Task-number: QTBUG-41702
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
---
 src/widgets/styles/qwindowsstyle.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 708014a6df3..a10bdc67e12 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -1821,6 +1821,20 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
         }
         return;
 #endif // QT_NO_DOCKWIDGET
+#ifndef QT_NO_COMBOBOX
+    case CE_ComboBoxLabel:
+        if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
+            if (cb->state & State_HasFocus) {
+                p->setPen(cb->palette.highlightedText().color());
+                p->setBackground(cb->palette.highlight());
+            } else {
+                p->setPen(cb->palette.text().color());
+                p->setBackground(cb->palette.background());
+            }
+        }
+        QCommonStyle::drawControl(ce, opt, p, widget);
+        break;
+#endif // QT_NO_COMBOBOX
     default:
         QCommonStyle::drawControl(ce, opt, p, widget);
     }
-- 
GitLab