[Qt-interest] Autosize QTableView

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


On Jan 19, 2009, at 8:25 AM, Alexandre Beraud wrote:

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

Oh, yeah, I tried that one too- came up short. Of course, maybe I just  
needed to add the width of the vertical header to the width of the  
horizontal header (and visa-versa for vertical) - I just tried the  
width of the horizontal header by itself. I'll have to try that. Thanks.

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

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





More information about the Qt-interest-old mailing list