Results 1 to 2 of 2

Thread: subclassing headerview 2

  1. #1
    Join Date
    Feb 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question subclassing headerview 2

    Hi all,

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

    protected:

    Qt Code:
    1. void paintSection(QPainter *painter, const QRect &rect, int logicalIndex)const
    2. {
    3. QHeaderView:: paintSection(painter, rect, logicalIndex);
    4. painter->save();
    5. painter->drawText(rect.x(), rect.y() + rect.height(), "test");
    6. painter->restore();
    7. }
    To copy to clipboard, switch view to plain text mode 

    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?
    Last edited by wysota; 25th February 2007 at 20:50. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: subclassing headerview 2

    Ok, got it.
    Had to reset the ClipRect of the painter.
    Thanks to all who spend time in this so far!

Similar Threads

  1. [ItemView] Bug in headerview
    By lauranger in forum Qt Programming
    Replies: 3
    Last Post: 14th August 2006, 11:55
  2. Problem with QTreeWidget after subclassing
    By steve918 in forum Qt Programming
    Replies: 2
    Last Post: 28th July 2006, 18:51
  3. Problem in SubClassing QTableItem.
    By sumsin in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2006, 10:21
  4. Subclassing QScrollView
    By sumsin in forum Qt Programming
    Replies: 13
    Last Post: 16th March 2006, 14:20
  5. Subclassing
    By joseph in forum Newbie
    Replies: 1
    Last Post: 25th February 2006, 14:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.