On Jun 26, 2012, at 5:43 AM, André Somers wrote: > Op 25-6-2012 22:35, Michael Jackson schreef: >> 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@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest > Yes, that can be done. It does not matter if you use QTableView or > QTableWidget (though I think the latter is big mistake to have in Qt): > QTableWidget is based on QTableView, so it can do everything QTableView > can do. > > You can use the resizeRowToContents or resizeRowsToContents slots (note > the singular vs plural of the 'row' noun in those method names.) > > André
Just to follow up it seems that we are doing something in our application that is negating the effects of resizeRowToContents(). I reduced our app to a toy problem with just a QTableWidget, put some dummy data in it and called resizeRowToContents() and the result was what I expected. Thanks to those that sanity checked this for me. ---- Mike Jackson _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest