Results 1 to 5 of 5

Thread: QTreeView expand and collapse

  1. #1
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QTreeView expand and collapse

    Hi I have a little problem with QTreeView and expand collapse behaviour.

    If I collapse a parent the childs of the parent dont't get collapsed. Is there a way to achieve that all childs are collapsed if their parent get collapsed, without implementing a collapsed_slot in
    the QTreeView?

    thanks

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QTreeView expand and collapse

    Do you mean children are visible event afer parent is collapsed?
    or
    Do you mean children are still expanded, after parent is collapsed and expanded back?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTreeView expand and collapse

    thank you for your reply santosh!

    the second one...

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QTreeView expand and collapse

    I am afraid you have to implement either a slot, or a custom QTreeView class, and do recurssive collapse on all the children and sub-children ....
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  5. The following user says thank you to Santosh Reddy for this useful post:

    Qiieha (9th October 2012)

  6. #5
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTreeView expand and collapse

    Ok, thank you.
    I expected that.

Similar Threads

  1. Replies: 3
    Last Post: 19th July 2012, 09:32
  2. Replies: 0
    Last Post: 26th June 2012, 04:07
  3. QTreeWidget Expand/Collapse Button Size
    By Slewman in forum Qt Programming
    Replies: 3
    Last Post: 28th July 2010, 11:07
  4. Collapse/Expand button in QTreeViewWidget
    By Skorpien126 in forum Qt Programming
    Replies: 3
    Last Post: 10th June 2010, 12:30
  5. preserve collapse/expand of a QTreeView
    By yazwas in forum Qt Programming
    Replies: 1
    Last Post: 7th November 2009, 09:49

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.