Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QTreeView

    General and Desktop
    2
    3
    103
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      TinTin82 last edited by TinTin82

      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

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        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.

        (Z(:^

        1 Reply Last reply Reply Quote 3
        • T
          TinTin82 last edited by

          Hi Sierdzio,

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

          Best regards,
          TinTin

          1 Reply Last reply Reply Quote 0
          • First post
            Last post