diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index a8ee72ed7f..10adcd1b6a 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1287,6 +1287,10 @@ class Application(QApplication): if cft >= 0: self.setCursorFlashTime(int(cft)) + @property + def using_calibre_style(self) -> bool: + return self.palette_manager.using_calibre_style + @property def is_dark_theme(self): return self.palette_manager.is_dark_theme diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index 939e5480b1..0d0f5fb7f9 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -1061,6 +1061,12 @@ class BookInfo(HTMLDisplay): ac.current_url = ac.current_fmt = None self.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.setDefaultStyleSheet(css()) + if iswindows and not QApplication.instance().using_calibre_style: + # workaround Qt bug that causes selected text to be invisible on + # windows when using system theme + bg = self.palette().color(QPalette.ColorRole.Highlight).name() + fg = self.palette().color(QPalette.ColorRole.HighlightedText).name() + self.setStyleSheet(f'QTextBrowser {{ selection-color: {fg}; selection-background-color: {bg}; }}') def change_layout(self, vertical): if vertical != self.vertical: