This commit is contained in:
Kovid Goyal 2023-04-28 09:02:46 +05:30
parent 8ead6c26f0
commit db3bd2d25c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -552,13 +552,12 @@ class CcMarkdownDelegate(QStyledItemDelegate): # {{{
''' '''
def __init__(self, parent): def __init__(self, parent):
QStyledItemDelegate.__init__(self, parent) super().__init__(parent)
self.document = QTextDocument() self.document = QTextDocument()
def paint(self, painter, option, index): def paint(self, painter, option, index):
self.initStyleOption(option, index) self.initStyleOption(option, index)
style = QApplication.style() if option.widget is None \ style = QApplication.style() if option.widget is None else option.widget.style()
else option.widget.style()
option.text = markdown(option.text) option.text = markdown(option.text)
self.document.setHtml(option.text) self.document.setHtml(option.text)
style.drawPrimitive(QStyle.PrimitiveElement.PE_PanelItemViewItem, option, painter, widget=option.widget) style.drawPrimitive(QStyle.PrimitiveElement.PE_PanelItemViewItem, option, painter, widget=option.widget)