Results 1 to 2 of 2

Thread: How to add a horizontal scrollbar to a treeview?

  1. #1
    Join Date
    Jun 2009
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How to add a horizontal scrollbar to a treeview?

    In my program, I use a treeview to show my items.
    If I add too many items into my treeview, it will work as:



    If there is too many items, the treeview will auto have a verticality scrollbar.
    But if one item is too long, why do not the treeview auto have a horizontal scrollbar?

    Some net-friend told me

    I think it is default QHeaderView behaviour. To change it try something like
    ...->header()->setStretchLastSection
    ...->header()->setResizeMode(QHeaderView::ResizeToContents);
    It works. But before this code, I doulbe clicked the treeview's item ,it will quick expand.
    After add this code, I found it expand slowly very much.
    Each item has about 100 children.
    Attached Images Attached Images
    • File Type: jpg 2.jpg (18.1 KB, 20 views)

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to add a horizontal scrollbar to a treeview?

    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. QTreeWidget horizontal scrollbar
    By ttvo in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2009, 16:44
  2. Horizontal scrollbar problem
    By blaylockr in forum Newbie
    Replies: 2
    Last Post: 21st July 2008, 17:38
  3. Treeview scrollbar not updating when inserting rows
    By Khal Drogo in forum Qt Programming
    Replies: 11
    Last Post: 29th November 2007, 13:13
  4. GraphicsView/GraphicsScene: scrollbar policy Qt::ScrollBarAsNeeded
    By Pieter from Belgium in forum Qt Programming
    Replies: 4
    Last Post: 21st March 2007, 13:15
  5. Horizontal scrollbar tracking problem
    By tebessum in forum Qt Programming
    Replies: 1
    Last Post: 23rd December 2006, 23:15

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.