[Qt-interest] Autosize QTableView

Alexandre Beraud aberaud at infflux.com
Mon Jan 19 18:25:21 CET 2009


Hi,

I have not tested it, but my first guess would be to use 
QHeaderView::length() for both directions.

Regards,

Alex


Israel Brewster a écrit :
> 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
> -----------------------------------------------
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>   


-- 
BERAUD Alexandre
Ingénieur Développement

Infflux - Informatique & Flux
Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
Mail: aberaud at infflux.com
Visitez notre site :  www.infflux.com





More information about the Qt-interest-old mailing list