Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTreeView



  • 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?

    IS:
    0_1567793361795_Ist.jpg
    SHOULE:
    0_1567793427154_Soll.jpg


  • 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,
    TinTin


Log in to reply