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. [SOLVED] QTreeView hierarchy decorations
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QTreeView hierarchy decorations

Scheduled Pinned Locked Moved General and Desktop
qtreeview
2 Posts 2 Posters 2.6k Views 2 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.
  • M Offline
    M Offline
    mkolenda
    wrote on last edited by mkolenda
    #1

    I would like make QTreeView to look like QTreeWidget. One of the decorations in QTreeWidget are these lines: http://i.imgur.com/wzOuIj0.png
    Do I really have to draw them manually in my own item delegate?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #2

      By default branch indicators depend on a used style. For example on windows the style "Windows" shows them while "Fusion" or "WindowsVista" doesn't. And it's the case for both QTreeView and QTreeWidget.

      If you want to have them drawn regardless of the used style (which is a little evil if you ask me) then yes, you need to draw them yourself to make them look however you want. Preferably you can do that by subclassing QTreeView and implementing drawBranches() and not via a delegate, as it is intended to draw items and branches are not considered part of them.

      You can also style the branches using stylesheets. Here's an example of how to do that.

      1 Reply Last reply
      1

      • Login

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