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 >> > 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é
Hmm, I have tried that but nothing is really working. I have turned on "wordwrap", set the various properties for both the vertical and horizontal header but nothing seems to work. I think I may be going about this wrong. Basically I think I want a certain column to be a specific width (say 200 pixels) and then as the text that gets displayed in that column becomes too wide I would like the row height to be adjusted to show all of the text. So do I need to somehow set the column width to a fixed size? Thanks Mike Jackson _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest