[PyQt] embedding iconic pushButton in TableView and/or TreeView

James Polk jpolk5001 at yahoo.com
Sun Nov 28 20:05:42 GMT 2010

'nuther woooohoooo!...I got a button!, lol...
A button in the first column of a TreeView on startup..

Unfortunately, it's not a PushButton, so it's not "pushing", lol...
but surely that's something I'm overlooking....but apparently
QStyleOption has no "PushButton",....but maybe I need to
pass an argument type when declaring,...

class DabDelegate(QStyledItemDelegate):

    def __init__(self, parent=None):
        super(DabDelegate, self).__init__(parent)

    def paint(self, painter, option, index):
        if index.column() == 0:         # Thumbnail
                parent   = self.parent()
                button = QStyleOptionButton()
                button.rect = option.rect
                QApplication.style().drawControl(QStyle.CE_PushButton, button, painter)

                QStyledItemDelegate.paint(self, painter, option, index)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101128/c24fb4b4/attachment-0001.html>

More information about the PyQt mailing list