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. QTreeWidget with connecting lines for the tree branches
Forum Update on Monday, May 27th 2025

QTreeWidget with connecting lines for the tree branches

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtreewidget
5 Posts 2 Posters 6.7k Views
  • 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.
  • F Offline
    F Offline
    floatingWoods
    wrote on last edited by
    #1

    Hi,
    I have a quite complex QTreeWidget (tree of objects), and with the "fusion" style, the branches of the tree are not visible, which is very confusing. I noticed that if I set the QTreeWidget to "windows" style, I get what I want. Except that the style doesn't match the rest of the application anymore.

    Is there another way to have the branches of a QTreeWidget be visible?

    Thanks for any help

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      have you tried with stylesheet on QTreeView::branch http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtreeview ?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • F Offline
        F Offline
        floatingWoods
        wrote on last edited by
        #3

        Hello VRonin,

        that was exactly what I was looking for! Thanks a lot. Now it looks as below. Everything looks fine, except when I have one (or more) selected item and my QTreeWidget doesn't have the focus: there is a blue part that wasn't there previously. Any idea why that appeared, or how I can get rid of it? I didn't touch any color when setting the stylesheet:

        alt text

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          When setting a stylesheet it removes the previous default so I'm afraid you'll need to finde the correct pseudo-state and apply the background colour manually

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          3
          • F Offline
            F Offline
            floatingWoods
            wrote on last edited by
            #5

            Again, thanks a lot for your help :)

            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