From 11f42fcc7ba37b8299d261f7bec075f5e0772039 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jacob=20St=C3=B8ren?= <jacob.storen@ceetronsolutions.com>
Date: Wed, 30 Oct 2019 12:40:04 +0100
Subject: [PATCH] #4956 caf: Fixed background color change problem in List
 Editor

---
 Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp
index b84135d0ed..ee8b34d4f7 100644
--- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp
+++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp
@@ -201,10 +201,17 @@ void PdmUiListEditor::configureAndUpdateUi(const QString& uiConfigName)
     {
         uiObject->editorAttribute(uiField()->fieldHandle(), uiConfigName, &attributes);
         
-        QPalette myPalette(m_listView->palette());
-        myPalette.setColor(QPalette::Base, attributes.m_baseColor);
+        QPalette myPalette;
+
+        if (attributes.m_baseColor == myPalette.color(QPalette::Active, QPalette::Base))
+        {
+            m_listView->setStyleSheet("");
+        }
+        else
+        {
+            m_listView->setStyleSheet("background-color: " + attributes.m_baseColor.name() + ";");
+        }
 
-        m_listView->setPalette(myPalette);
         m_listView->setHeightHint(attributes.m_heightHint);
         if (!attributes.m_allowHorizontalScrollBar)
         {