[Interest] SOLVED: QStyledItemDelegate's sizeHint() height being ignored by QTableWidget?

Bob Hood bhood2 at comcast.net
Mon Jan 4 16:19:25 CET 2016


On 1/3/2016 7:30 PM, Bob Hood wrote:
> Am I going to have to use a QTableView with a model in order to get the 
> height I need in each cell, or might this be a bug?

Since all my images are the same height, I solved this by directly calling 
QTableWidget's inherited method setRowHeight(). This has expanded the row 
height to fit the image content.  I can center images in that height in the 
QStyledItemDelegate.paint() method if for some reason they don't fit exactly.

However, it seemed more intuitive to me that the 
QStyledItemDelegate.sizeHint() return valuewould cause the underlying 
QTableView to make that adjustment for me.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160104/372dcf19/attachment.html>


More information about the Interest mailing list