mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix for flashing in the tag browser. See https://www.mobileread.com/forums/showthread.php?p=4341802#post4341802
This commit is contained in:
parent
285a538e37
commit
9362da31ff
@ -68,15 +68,15 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
|||||||
icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.State.On)
|
icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.State.On)
|
||||||
|
|
||||||
def paint_text(self, painter, rect, flags, text, hover):
|
def paint_text(self, painter, rect, flags, text, hover):
|
||||||
set_color = hover and QApplication.instance().is_dark_theme
|
painter.save()
|
||||||
if set_color:
|
pen = painter.pen()
|
||||||
painter.save()
|
if hover and QApplication.instance().is_dark_theme:
|
||||||
pen = painter.pen()
|
|
||||||
pen.setColor(QColor(Qt.GlobalColor.black))
|
pen.setColor(QColor(Qt.GlobalColor.black))
|
||||||
painter.setPen(pen)
|
else:
|
||||||
|
pen.setColor(QColor(Qt.GlobalColor.white))
|
||||||
|
painter.setPen(pen)
|
||||||
painter.drawText(rect, flags, text)
|
painter.drawText(rect, flags, text)
|
||||||
if set_color:
|
painter.restore()
|
||||||
painter.restore()
|
|
||||||
|
|
||||||
def draw_text(self, style, painter, option, widget, index, item):
|
def draw_text(self, style, painter, option, widget, index, item):
|
||||||
tr = style.subElementRect(QStyle.SubElement.SE_ItemViewItemText, option, widget)
|
tr = style.subElementRect(QStyle.SubElement.SE_ItemViewItemText, option, widget)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user