Important: Please read the Qt Code of Conduct -


  • Hi,
    I derived a class from QTreeView.
    Now I do not know how to paint edges / separators around the individual items.
    What I do not realize is how to draw the tree structure on the left side.
    Does anyone know an example of these topics?
    Or a rough description of the steps I have to implement for it?


  • Moderators

    The tree branches can be painted with drawBranches or using QSS (see Qt Style Reference page in docs).

    For borders around items, I think you need to use a custom subclass of QAbstractItemDelegate and it's paint() method, then supply that delegate to view via setItemDelegate().

    Perhpas there is some easier way, though, I don't know.

  • Hi Sierdzio,

    Thanks for the quick help. I think the info is enough for me.

    Best regards,

Log in to reply