[Qt-interest] Autosize QTableView

Israel Brewster israel at frontierflying.com
Mon Jan 19 18:13:57 CET 2009


I'm trying to figure out how to automatically size a QTableView (and  
enclosing window) to fit the contents of the table view without scroll  
bars, if possible. Of course, this would be limited by the size of the  
display, among other things. I thought I might be able to just use the  
size hint from the QTableView, but this is way smaller than needed. I  
also tried adding the column widths and the width of the vertical  
header (and the same basic procedure for the height), but this also  
came out too small, by almost a column. I can, of course, add some  
arbitrary fixed number to this amount to make up the difference  
(actually, this is what I am doing), but that just feels kludgy to me.  
The height is even more complicated, as I need to take into account  
things like the tool bar, title bar, status bar, etc. Is there a  
better way to determine the needed size? Thanks.

-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------





More information about the Qt-interest-old mailing list