Example #1
0
 def drawBackground(self, painter, option, index):
     QItemDelegate.drawBackground(self,painter,option,index)
     item = index.model().itemFromIndex(index)
     print('----------- About to paint item with priority {0}'.format(item.task.priority))
     item.setBackground(self.rowColors[item.task.priority])
     painter.save()
     #painter.restore()
Example #2
0
    def paint(self, painter, option, index):
        painter.save()

        column = index.column()
        if column == 1:
            icon = index.model().data(index, Qt.DecorationRole)
            pixmap = icon.pixmap(option.rect.size() * 0.9)
            x = option.rect.left() + option.rect.width() / 2 - pixmap.width() / 2
            rect = QRect(x, option.rect.top(), pixmap.width(), pixmap.height())
            painter.drawPixmap(rect, pixmap)
        else:
            QItemDelegate.paint(self, painter, option, index)

        painter.restore()
Example #3
0
 def __init__(self, parent=None):
     QItemDelegate.__init__(self, parent)
 def __init__(self, parent=None):
     QItemDelegate.__init__(self, parent)
     self._readonly = False
Example #5
0
 def __init__(self, parent=None):
     QItemDelegate.__init__(self, parent)
 def updateEditorGeometry(self, QWidget, QStyleOptionViewItem, QModelIndex):
     QItemDelegate.updateEditorGeometry(self, QWidget, QStyleOptionViewItem, QModelIndex)
Example #7
0
 def updateEditorGeometry(self, QWidget, QStyleOptionViewItem, QModelIndex):
     QItemDelegate.updateEditorGeometry(self, QWidget, QStyleOptionViewItem,
                                        QModelIndex)