[Interest] SOLVED: QStyledItemDelegate's sizeHint() height being ignored by QTableWidget?
Bob Hood
bhood2 at comcast.net
Mon Jan 4 16:47:25 CET 2016
On 1/4/2016 8:38 AM, Elvis Stansvik wrote:
> 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.
Hi, Elvis.
Yeah, I was doing that in the code as the last action. I just didn't include
it in the original post.
More information about the Interest
mailing list