changeset 24843:bf1bace6d01d

Use OS GUI highlight backgroud color for variable editor name label (bug #53274) * variable-editor.cc (variable_dock_widget::handle_focus_change): Rather than style sheet, use the Qt definitions for picking the operating system GUI's background highlight color as well as its contrasting foreground text. (variable_editor::edit_variable): Add two pixels of margin around a panel's name label for better highlight balance.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Sun, 04 Mar 2018 03:52:58 -0600
parents 74229798f604
children fc21ac9cd998
files libgui/src/variable-editor.cc
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/variable-editor.cc	Tue Mar 06 18:48:09 2018 +0100
+++ b/libgui/src/variable-editor.cc	Sun Mar 04 03:52:58 2018 -0600
@@ -175,7 +175,10 @@
       {
         QLabel *label = titleBarWidget ()->findChild<QLabel *> ();
         if (label != nullptr)
-          label->setStyleSheet ("QLabel {background: skyblue;}");
+          {
+            label->setBackgroundRole (QPalette::Highlight);
+            label->setAutoFillBackground (true);
+          }
 
         emit variable_focused_signal (objectName ());
       }
@@ -183,7 +186,7 @@
       {
         QLabel *label = titleBarWidget ()->findChild<QLabel *> ();
         if (label != NULL)
-          label->setStyleSheet ("QLabel {background: transparent;}");
+          label->setBackgroundRole (QPalette::NoRole);
       }
   }
 
@@ -1083,6 +1086,7 @@
     QLabel *existing_ql = page->titleBarWidget ()->findChild<QLabel *> ();
     connect (model, SIGNAL (update_label_signal (const QString&)),
              existing_ql, SLOT (setText (const QString&)));
+    existing_ql->setMargin (2);
 
     model->update_data (val);