Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTreeView
Qt 6.11 is out! See what's new in the release blog

QTreeView

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 566 Views 1 Watching
  • 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 Offline
    T Offline
    TinTin82
    wrote on last edited by TinTin82
    #1

    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
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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
      3
      • T Offline
        T Offline
        TinTin82
        wrote on last edited by
        #3

        Hi Sierdzio,

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

        Best regards,
        TinTin

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved