<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><br>>Just remember, that small self contained examples of such issues are the <br>>ultimate weapon to engage them...<br>>Pete<br><br>lol, totally,...I went back to Mark Summerfield's book again (and other<br>examples)...<br><br>I'm soooooo close...but still a step or two go...<br><br>Finally figured out how to use my delegate's "sizeHint" to adjust<br>the row height in a QTreeView..<br><br> def sizeHint(self, option, index):<br> fm = option.fontMetrics<br> if index.column() == 2: # LongName, but could be any column #<br> text =
index.model().data(index)<br> document = QTextDocument()<br> document.setDefaultFont(option.font)<br> return QSize(document.idealWidth() + 5, 50)<br> return QStyledItemDelegate.sizeHint(self, option, index)<br><br>...the "50" being the height I needed for a 50x50 icon image in the<br>first column....<br><br>So,...it finally occurred to me that when MarkS says a delegate<br>can have "total control"...then that must mean everything must<br>pass thru the "paint" function...which strikes me as more of a filter<br>than a function,..but anyways...<br>Right now, I have<br><br> def paint(self, painter, option,
index):<br> if index.column() == 0: # Thumbnail<br> parent = self.parent()<br> iconFile = index.model().data(index, Qt.DisplayRole)<br> button = QPushButton("&Icon", parent)<br> icon = QIcon(iconFile)<br> pixmap = icon.pixmap(QSize(50, 50) )<br>
button.setIcon(icon)<br><br> painter.save()<br> painter.drawPixmap(0, 0, 50, 50, pixmap )<br> painter.restore()<br> else:<br> QStyledItemDelegate.paint(self, painter, option, index)<br><br>So, even though there's a PushButton definition in there, I still can't<br>get it to display at startup. I have been able though to define an<br>Icon and Pixmap, (passing the image filename from data() )<br>but painter only wants (it appears) to draw a pixmap, and not a<br>pushbutton...so I'm kinda' stuck there at the moment...<br>But I do have these pixmaps
showing at startup...so I'm think I'm<br>tantalizing close to a solution...<br><br>Now it might be,...that I may not absolutely need a pushbutton type..<br>I just need to enable the user that once they click on pixmap/button<br>that it would execute a function. Even that could be argued away<br>with,...by proving a RMB (rightmousebutton) pulldown menu in the<br>main view...Even so, I'd still like to understand and know how to do<br>the former,etc..<br><br>Anyways,...Any suggestions greatly appreciated...and Thanks again, Pete, for your help and interest,<br>Cheers,<br>-James<br></td></tr></table><br>