Переглянути джерело

Enfore ctkAxesWidget current axis to be highlighted

even when unfocus/inactive.
Julien Finet 13 роки тому
батько
коміт
bba99f1908

+ 5 - 0
Libs/Widgets/Testing/Cpp/ctkAxesWidgetTest1.cpp

@@ -86,8 +86,13 @@ int ctkAxesWidgetTest1(int argc, char * argv [] )
     }
   axes.setAutoReset(false);
   axes.setAutoReset(true);
+  axes.setWindowTitle("AutoReset=On");
   axes.show();
 
+  ctkAxesWidget axes2;
+  axes2.setWindowTitle("AutoReset=Off");
+  axes2.show();
+
   if (argc < 2 || QString(argv[1]) != "-I" )
     {
     QTimer::singleShot(200, &app, SLOT(quit()));

+ 3 - 3
Libs/Widgets/ctkAxesWidget.cpp

@@ -265,7 +265,7 @@ void ctkAxesWidget::paintEvent(QPaintEvent *)
         {
         pen.setWidth(3);
         //pen.setColor(QColor(64, 64, 72)); // Payne's grey
-        pen.setColor(this->palette().color(QPalette::Highlight));
+        pen.setColor(this->palette().color(QPalette::Active, QPalette::Highlight));
         }
       painter.setPen(pen);
       }
@@ -280,11 +280,11 @@ void ctkAxesWidget::paintEvent(QPaintEvent *)
   if (//d->HighlightAxes &&
       d->HighlightAxis == ctkAxesWidget::None)
     {
-    rg.setColorAt(0., this->palette().color(QPalette::Highlight));
+    rg.setColorAt(0., this->palette().color(QPalette::Active, QPalette::Highlight));
     }
   else
     {
-    rg.setColorAt(0., this->palette().color(QPalette::Light));
+    rg.setColorAt(0., this->palette().color(QPalette::Active, QPalette::Light));
     }
   rg.setColorAt(1., QColor(64, 64, 72));
   painter.setBrush(QBrush(rg));