PDA

View Full Version : subclassing headerview 2



TheM
25th February 2007, 20:37
Hi all,

I want to add some additional painting to my subclassed headerview and i'm doing this:

protected:


void paintSection(QPainter *painter, const QRect &rect, int logicalIndex)const
{
QHeaderView:: paintSection(painter, rect, logicalIndex);
painter->save();
painter->drawText(rect.x(), rect.y() + rect.height(), "test");
painter->restore();
}

I thought it works just like overpainting the super class stuff, so I can keep the L&F and add something I want, but unfortunately the code after

QHeaderView:: paintSection(painter, rect, logicalIndex);

doesn't work.
When I leave it out, the 'test' text appears but the Look and the Feel are certainly away.

Any suggestions?

TheM
26th February 2007, 18:54
Ok, got it.
Had to reset the ClipRect of the painter.
Thanks to all who spend time in this so far!