8

Does anyone know if it's possible the flatten a QTreeView/QTreeWidget while still being able to expand child items.

What the default is:

- A
  -> A1
  -> A2
- B
  -> B2
+ C

- is expanded and + is collapsed

What I would like:

- A
  A1
  A2
- B
  B2
+ C

all collapsed

+ A
+ B
+ C

A, B, C are the root items.

3
  • Can you get it from styling the QTreeView's items? Here is an example that styles things like color, but not much to see on actually positioning the items. You can use selectors to get the QTreeView's nodes and children, so you may be able to use the QSS to position the sub items. This is only a suggestion, though. Hence it being a comment and not an answer. Commented Jun 15, 2012 at 2:51
  • If I could just style it that would be the easiest. I haven't tried. Commented Jun 15, 2012 at 2:54
  • hmmm never used to be like that, used to just be given to the accepted answer. All good. Commented Jun 25, 2012 at 9:04

1 Answer 1

7
+100
MyTree -> setIndentation (0) ;
Sign up to request clarification or add additional context in comments.

2 Comments

i.e. MyTree.setIndentation(0) in PyQt.
I would still like the + or - if I can. This seems to remove it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.