Results 1 to 2 of 2

Thread: QTreeWidget - preventing columns from being resized.

  1. #1
    Join Date
    Sep 2007
    Posts
    15
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default QTreeWidget - preventing columns from being resized.

    Hello,

    I'm developing an embedded application using qtopia core (which is functionally identical to qt4), and I don't want the user to be able to resize a column of my QTreeWidget. I've been settings column widths in this manner:

    Qt Code:
    1. headings << "Description" << "Qty" << "Unit price" << "Total price";
    2. mymainscreen.treeWidget_products->setHeaderLabels(headings);
    3. mymainscreen.treeWidget_products->setColumnWidth(0,360);
    4. mymainscreen.treeWidget_products->setColumnWidth(1,32);
    5. mymainscreen.treeWidget_products->setColumnWidth(2,72);
    6. mymainscreen.treeWidget_products->setColumnWidth(3,72);
    To copy to clipboard, switch view to plain text mode 
    mymainscreen is a ui object, so the QTreeWidget pointer, "treeWidget_products" is "instantiated" there.

    I want to prevent the objects columns from being resized. How is this possible?

    I've already figured out how to remove the cursor, because it's a touchscreen system:

    Qt Code:
    1. QApplication::setOverrideCursor(QCursor(Qt::BlankCursor) );
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance,
    Sternocera

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTreeWidget - preventing columns from being resized.

    See QHeaderView::setResizeMode(). You can access the header via QTreeView::header().
    J-P Nurmi

Similar Threads

  1. Re: QTreeWidget columns
    By npc in forum Newbie
    Replies: 2
    Last Post: 8th March 2007, 14:45
  2. QTreeWidget columns
    By xgoan in forum Newbie
    Replies: 3
    Last Post: 27th February 2007, 20:01
  3. Resize QTreeWidget columns to contents
    By FaS in forum Qt Programming
    Replies: 9
    Last Post: 2nd July 2006, 20:48
  4. How to capture resizing of QTreeWidget columns?
    By simk in forum Qt Programming
    Replies: 2
    Last Post: 27th April 2006, 06:10

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.