Exemple #1
0
    def paint(self, painter: QtGui.QPainter,
              option: QtWidgets.QStyleOptionViewItem,
              index: QtCore.QModelIndex):

        painter.save()

        options = QtWidgets.QStyleOptionViewItem(option)
        self.initStyleOption(options, index)

        painter.translate(options.rect.left(), options.rect.top())

        doc = QtGui.QTextDocument()
        doc.setHtml(self.makeHtml(index.data()))
        doc.drawContents(painter)

        painter.restore()
Exemple #2
0
 def setEditorData(self, editor: QWidget, index: QModelIndex) -> None:
     editor.selected_id = index.data()