changeset 22616:96411a33f570 stable

gui: handle differences in text color for popmenu, checkbox and radiobutton (Bug #49247) * libgui/graphics/BaseControl.cc (QtHandles::updatePalette): apply unique color settings for popmenu, checkbox and radiobutton.
author John Donoghue <john.donoghue@ieee.org>
date Tue, 11 Oct 2016 19:21:49 -0400
parents 78b3c48be3e6
children 51b7d8456ce3
files libgui/graphics/BaseControl.cc
diffstat 1 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/BaseControl.cc	Tue Oct 11 13:26:54 2016 -0400
+++ b/libgui/graphics/BaseControl.cc	Tue Oct 11 19:21:49 2016 -0400
@@ -42,18 +42,35 @@
     QPalette p = w->palette ();
 
     if (props.style_is ("edit")
-        || props.style_is ("listbox")
-        || props.style_is ("popupmenu"))
+        || props.style_is ("listbox"))
       {
         p.setColor (QPalette::Base,
                     Utils::fromRgb (props.get_backgroundcolor_rgb ()));
         p.setColor (QPalette::Text,
                     Utils::fromRgb (props.get_foregroundcolor_rgb ()));
       }
+    else if (props.style_is ("popupmenu"))
+      {
+        // popumenu (QComboBox) is a listbox with a button, so needs set colors for both
+        p.setColor (QPalette::Base,
+                    Utils::fromRgb (props.get_backgroundcolor_rgb ()));
+        p.setColor (QPalette::Text,
+                    Utils::fromRgb (props.get_foregroundcolor_rgb ()));
+        p.setColor (QPalette::Button,
+                    Utils::fromRgb (props.get_backgroundcolor_rgb ()));
+        p.setColor (QPalette::ButtonText,
+                    Utils::fromRgb (props.get_foregroundcolor_rgb ()));
+      }
+    else if (props.style_is ("radiobutton")
+             || props.style_is ("checkbox"))
+      {
+        p.setColor (QPalette::Button,
+                    Utils::fromRgb (props.get_backgroundcolor_rgb ()));
+        p.setColor (QPalette::WindowText,
+                    Utils::fromRgb (props.get_foregroundcolor_rgb ()));
+      }
     else if (props.style_is ("pushbutton")
-             || props.style_is ("togglebutton")
-             || props.style_is ("radiobutton")
-             || props.style_is ("checkbox"))
+             || props.style_is ("togglebutton"))
       {
         p.setColor (QPalette::Button,
                     Utils::fromRgb (props.get_backgroundcolor_rgb ()));