Results 1 to 3 of 3

Thread: How to adjust the a QHeaderView's width

  1. #1
    Join Date
    Jan 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default How to adjust the a QHeaderView's width

    I used a QTableWidget in my program, there was also a vertical header, after starting the program's run, when i clicked the vertical header, i want to add a QtableWidgetItem to the vertical header using "serVerticalHeaderItem( logicalIndex, pItem)", but the width of the vertical header doesn't adjust to display the whole icon image, how can i make this working better?

    code:
    Qt Code:
    1. QTableWidgetItem* pItem = new QTableWidgetItem(QIcon(tr(":/Images/breakpoint.png")), tr(""));
    2.  
    3. setVerticalHeaderItem( argLogicalIndex, pItem );
    To copy to clipboard, switch view to plain text mode 

    ps: i tryed resizeSecton(), but it doesn't work!
    resizeSection works correctly for the horizontalHeader(), but it resizes the height instead of the width in the verticalHeader()
    Last edited by marcel; 31st January 2008 at 07:52.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to adjust the a QHeaderView's width

    You could try verticalHeaderItem()->setSizeHint(pixmapSize);

  3. #3
    Join Date
    Jan 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to adjust the a QHeaderView's width

    Thank you, it does work^_^

Similar Threads

  1. How to obtain the width of a QTableWidget?
    By Giel Peters in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 22:34

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.