From d5f3bd1de2e5f3492611462f53801d2de2f0f3aa Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Jan 2026 07:56:45 +0530 Subject: [PATCH] Fix rendering of checkboxes in light mode also broken in Qt 6.10 fusion theme Apply same workaround as was used for dark mode to light mode as well --- .../gui2/progress_indicator/CalibreStyle.cpp | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/calibre/gui2/progress_indicator/CalibreStyle.cpp b/src/calibre/gui2/progress_indicator/CalibreStyle.cpp index 43739e582f..8f0de2fdc0 100644 --- a/src/calibre/gui2/progress_indicator/CalibreStyle.cpp +++ b/src/calibre/gui2/progress_indicator/CalibreStyle.cpp @@ -320,23 +320,22 @@ void CalibreStyle::drawPrimitive(PrimitiveElement element, const QStyleOption * } break; // }}} - case PE_IndicatorCheckBox: // {{{ - // Fix color used to draw checkbox outline in dark mode - if (is_color_dark(option->palette.color(QPalette::Window))) { - baseStyle()->drawPrimitive(element, option, painter, widget); - painter->save(); - painter->translate(0.5, 0.5); - QRect rect = option->rect; - rect = rect.adjusted(0, 0, -1, -1); + case PE_IndicatorCheckBox: { // {{{ + // Fix color used to draw checkbox outline + baseStyle()->drawPrimitive(element, option, painter, widget); + painter->save(); + painter->translate(0.5, 0.5); + QRect rect = option->rect; + rect = rect.adjusted(0, 0, -1, -1); + if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) + painter->setPen(QPen(is_color_dark(option->palette.color(QPalette::Window)) ? Qt::white : Qt::black)); + else painter->setPen(QPen(option->palette.color(QPalette::WindowText))); - if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) - painter->setPen(QPen(Qt::white)); - painter->drawRect(rect); - painter->restore(); - return; - } - break; // }}} + painter->drawRect(rect); + painter->restore(); + return; + } // }}} case PE_IndicatorRadioButton: // {{{ // Fix color used to draw radiobutton outline in dark mode