def paint(self, painter, option, index):
if not index.isValid():
return
painter.translate(0, 0)
options = QStyleOptionViewItemV4(option)
self.initStyleOption(options, index)
painter.save()
painter.
setRenderHint(QPainter.
Antialiasing,
True) doc.setHtml(options.text)
options.text = ""
options.
widget.
style().
drawControl(QStyle.
CE_ItemViewItem, options, painter, options.
widget) #<---ERROR painter.translate(options.rect.left() + self.sizeDp(index) + 3, options.rect.top()) #paint text right after the dp + 3pixels
rect
= QRectF(0,
0, options.
rect.
width(), options.
rect.
height()) doc.drawContents(painter, rect)
painter.restore()
def paint(self, painter, option, index):
if not index.isValid():
return
painter.translate(0, 0)
options = QStyleOptionViewItemV4(option)
self.initStyleOption(options, index)
painter.save()
painter.setRenderHint(QPainter.Antialiasing, True)
doc = QTextDocument()
doc.setHtml(options.text)
options.text = ""
options.widget.style().drawControl(QStyle.CE_ItemViewItem, options, painter, options.widget) #<---ERROR
painter.translate(options.rect.left() + self.sizeDp(index) + 3, options.rect.top()) #paint text right after the dp + 3pixels
rect = QRectF(0, 0, options.rect.width(), options.rect.height())
doc.drawContents(painter, rect)
painter.restore()
To copy to clipboard, switch view to plain text mode
Bookmarks