[Interest] Dynamically Resizing the height of a Row in a QTableWidget or QTableView

Eric Clark eclark at ara.com
Mon Jun 25 23:52:19 CEST 2012


Hello Mike,

I am not sure about dynamically resizing the row height, but I have a suggestion that you may or may not find helpful...

Instead of placing the entire portion of text in the table cell, why not use the QFontMetrics::elidedText(...) function to add ellipsis to the left, right or middle of your text and then set the tooltip on the cell to show the entire text when the text is too long? 

Hope this helps...
Eric

> -----Original Message-----
> From: interest-bounces+eclark=ara.com at qt-project.org [mailto:interest-
> bounces+eclark=ara.com at qt-project.org] On Behalf Of Michael Jackson
> Sent: Monday, June 25, 2012 3:35 PM
> To: Interests Qt
> Subject: [Interest] Dynamically Resizing the height of a Row in a
> QTableWidget or QTableView
> 
> Is it possible to dynamically set the row height based on the amount of text
> that needs to be displayed? We are trying to display some error messages in
> a table and some of the messages are very short (just a few words) and
> some of very long (lots and lots of words). Can this be done with a
> QTableWidget or should we move to a QTableView and custom model? Does
> anyone have any example code?
> 
> Thanks
> ---
> Mike Jackson
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list