QTreeWidget with connecting lines for the tree branches

  • Hi,
    I have a quite complex QTreeWidget (tree of objects), and with the "fusion" style, the branches of the tree are not visible, which is very confusing. I noticed that if I set the QTreeWidget to "windows" style, I get what I want. Except that the style doesn't match the rest of the application anymore.

    Is there another way to have the branches of a QTreeWidget be visible?

    Thanks for any help

  • Qt Champions 2018

    have you tried with stylesheet on QTreeView::branch http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtreeview ?

  • Hello VRonin,

    that was exactly what I was looking for! Thanks a lot. Now it looks as below. Everything looks fine, except when I have one (or more) selected item and my QTreeWidget doesn't have the focus: there is a blue part that wasn't there previously. Any idea why that appeared, or how I can get rid of it? I didn't touch any color when setting the stylesheet:

    alt text

  • Qt Champions 2018

    When setting a stylesheet it removes the previous default so I'm afraid you'll need to finde the correct pseudo-state and apply the background colour manually

  • Again, thanks a lot for your help :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.