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

Elvis Stansvik elvstone at gmail.com
Mon Jan 4 16:38:52 CET 2016


2016-01-04 16:19 GMT+01:00 Bob Hood <bhood2 at comcast.net>:
> 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 value would cause the underlying
> QTableView to make that adjustment for me.

I think you'll have to request that adjustment manually, with
resizeRowsToContents(). Not sure if you can have it done
automatically.

Elvis

>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list