[Qt-interest] QHeaderView height

Paul England pengland at cmt-asia.com
Fri Apr 3 01:43:43 CEST 2009


Thanks for the reply.
Although this seems to be giving me a zero. 

class my_table  : public QTableWidget
{

};

my_table::do_something()
{
    QVariant header_height    = model()->headerData( 0, Qt::Horizontal );
    int hh = header_height.toInt();
    printf( "model()->headerData( 0, Qt::Horizontal ) = %d\n", hh );
}

Output it "0". 

Paul

> Well perhaps you could try it with:
>
>
>       QAbstractItemMode::headerData ( int /section/, Qt::Orientation
>       <http://doc.trolltech.com/4.1/qt.html#Orientation-enum>
>       /orientation/, int /role/ = Qt::DisplayRole );
>
> just call this on the widgets model, with the proper orientation and 
> SizeRole.
>
> Benjamin Sonnemann
>
>
> On Thu, Apr 2, 2009 at 6:49 PM, Paul England <pengland at cmt-asia.com 
> <mailto:pengland at cmt-asia.com>> wrote:
>
>     Hey Gang
>
>     I'm resizing a QTableWidget.  Since I don't know of a way to set the
>     height of the widget to match the sum of the height of the rows + the
>     height of the horizontalHeader(), I'm doing it manually.
>
>     Caveat: no idea on Earth how to get the height of hozirontalHeader().
>     horizontalHeader()->sectionSize() gives me the width, which I can
>     easily
>     get from any one of the columns, so that's a bit useless.  Am I doing
>     this the hard way?  Missing something?
>
>     Heading to bed, so won't be able to give a proper thank you email
>     for a bit.
>
>     Cheers
>     Paul
>     _______________________________________________
>     Qt-interest mailing list
>     Qt-interest at trolltech.com <mailto:Qt-interest at trolltech.com>
>     http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>




More information about the Qt-interest-old mailing list