I'm trying something with a delegate but so far I got nothing, maybe you can help me to get this straight.
I created a custom delegate inheriting QStyledItemDelegate :
class ImageDelegate(QtGui.QStyledItemDelegate):
def __init__(self, parent):
QtGui.QStyledItemDelegate.__init__(self, parent)
def paint(self, painter, option, index):
# Get Item Data
path = "path\to\my\image.jpg"
opt.rect = option.rect
painter.drawPixmap(opt.rect, pixmap)
class ImageDelegate(QtGui.QStyledItemDelegate):
def __init__(self, parent):
QtGui.QStyledItemDelegate.__init__(self, parent)
def paint(self, painter, option, index):
# Get Item Data
path = "path\to\my\image.jpg"
style = QtGui.QApplication.style()
opt = QtGui.QStyleOptionGraphicsItem()
opt.rect = option.rect
pixmap = QtGui.QPixmap(path)
painter.drawPixmap(opt.rect, pixmap)
To copy to clipboard, switch view to plain text mode
And I call it like this :
self.delegateImage = ImageDelegate(self)
self.setItemDelegateForColumn(2, self.delegateImage)
self.delegateImage = ImageDelegate(self)
self.setItemDelegateForColumn(2, self.delegateImage)
To copy to clipboard, switch view to plain text mode
And I am sure the path is correct
What am I missing ?
Bookmarks