Skip to content

Commit 412c8ec

Browse files
Pierre Bourlassoanfinetjul
authored andcommitted
ENH: Draw ctkAxesWidget axes based on widget state
Ensure axes are drawn using either active or inactive color group associated with `QPalette::WindowText` based on the widget's enabled state. Co-authored-by: Andras Lasso <lasso@queensu.ca> Co-authored-by: Julien Finet <julien.finet@kitware.com>
1 parent 26688b1 commit 412c8ec

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Libs/Widgets/ctkAxesWidget.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,14 @@ void ctkAxesWidget::paintEvent(QPaintEvent *)
256256
// Drawing the lines
257257
for (int i = 0; i < 6; ++i)
258258
{
259-
//if (d->HighlightAxes)
259+
QPen pen(this->palette().color(this->isEnabled() ? QPalette::Active : QPalette::Inactive, QPalette::WindowText));
260+
if (d->HighlightAxis == (i + 1)) // axes start at 1
260261
{
261-
QPen pen;
262-
if (d->HighlightAxis == (i + 1)) // axes start at 1
263-
{
264-
pen.setWidth(3);
265-
//pen.setColor(QColor(64, 64, 72)); // Payne's grey
266-
pen.setColor(this->palette().color(QPalette::Active, QPalette::Highlight));
267-
}
268-
painter.setPen(pen);
262+
pen.setWidth(3);
263+
//pen.setColor(QColor(64, 64, 72)); // Payne's grey
264+
pen.setColor(this->palette().color(QPalette::Active, QPalette::Highlight));
269265
}
266+
painter.setPen(pen);
270267
painter.drawLine(center, positions[i]);
271268
}
272269

0 commit comments

Comments
 (0)