Proper text color for highlighted comment cells

This commit is contained in:
Kovid Goyal 2014-11-28 12:41:53 +05:30
parent c049cdfe8d
commit 0dab878ad5

View File

@ -415,10 +415,11 @@ class CcCommentsDelegate(QStyledItemDelegate): # {{{
style = QApplication.style() if option.widget is None \ style = QApplication.style() if option.widget is None \
else option.widget.style() else option.widget.style()
self.document.setHtml(option.text) self.document.setHtml(option.text)
option.text = u''
style.drawPrimitive(QStyle.PE_PanelItemViewItem, option, painter, widget=option.widget) style.drawPrimitive(QStyle.PE_PanelItemViewItem, option, painter, widget=option.widget)
ctx = QAbstractTextDocumentLayout.PaintContext() ctx = QAbstractTextDocumentLayout.PaintContext()
ctx.palette = option.palette ctx.palette = option.palette
if option.state & QStyle.State_Selected:
ctx.palette.setColor(ctx.palette.Text, ctx.palette.color(ctx.palette.HighlightedText))
textRect = style.subElementRect(QStyle.SE_ItemViewItemText, option) textRect = style.subElementRect(QStyle.SE_ItemViewItemText, option)
painter.save() painter.save()
painter.translate(textRect.topLeft()) painter.translate(textRect.topLeft())