Results 1 to 3 of 3

Thread: QTreeWidget horizontal scrollbar not working

  1. #1
    Join Date
    Feb 2012
    Location
    San Francisco, CA
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QTreeWidget horizontal scrollbar not working

    I see in the following thread that there are problems with QTreeWidget and horizontal scrollbars.

    http://www.qtcentre.org/threads/1239...dget-ScrollBar

    The above thread says this problem is supposed to be fixed, but I am using Qt 4.7.4 (open source version) and I see that the problem is still there.

    Here is the problem:

    I have a QTreeWidget in which each item has an icon and a text. The widget has been set to have horizontal and vertical scrollbars "as needed".
    The vertical scrollbar appears as expected. However, the horizontal scrollbar only appears when the size of the widget has shrunk to the point where it covers the icon.
    When the widget is shrunk to cover the text part, the horiz. scrollbar does not appear.

    And even when the horiz. scrollbar appears, it thinks the item is as wide as the icon only and therefore scrolls very little to show the icon. The text is still not visible.

    It seems to me that QTreeWidget does not have the proper size of each item. Is there a fix or a workaround for this? Any help is appreciated.

    Thanks,

    --abhijit

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTreeWidget horizontal scrollbar not working

    I don't think it's a bug.
    It seems to be designed this way.
    The scroll bar will apear only when view is reduced below value of headerMinimumSectionSize.
    You can set headerStretchLastSection to false and alow user to adjust the width of the column, or set headerMinimumSectionSize to whatever the width of visible items is every time you expand/collapse new item.

    QHeaderView is the place to have a look at.

  3. #3
    Join Date
    Feb 2012
    Location
    San Francisco, CA
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTreeWidget horizontal scrollbar not working

    Thanks, the solution you proposed works.

Similar Threads

  1. [solved] Horizontal scrollbar isn't show up.
    By DSblizzard in forum Newbie
    Replies: 1
    Last Post: 18th June 2010, 01:45
  2. QCompleter with horizontal ScrollBar
    By vajindarladdad in forum Newbie
    Replies: 2
    Last Post: 31st August 2009, 06:01
  3. How to add a horizontal scrollbar to a treeview?
    By yangyunzhao in forum Qt Programming
    Replies: 1
    Last Post: 20th August 2009, 08:24
  4. QTreeWidget horizontal scrollbar
    By ttvo in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2009, 16:44
  5. Horizontal scrollbar problem
    By blaylockr in forum Newbie
    Replies: 2
    Last Post: 21st July 2008, 17:38

Tags for this Thread

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.