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. QTreeWidgetItem setDecorated False
Qt 6.11 is out! See what's new in the release blog

QTreeWidgetItem setDecorated False

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.5k 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.
  • E Offline
    E Offline
    elveatles
    wrote on last edited by
    #1

    Hi, I'm using PyQt4, but it should be very similar to C++.
    I'm hiding the expand / collapse symbols in the QTreeWidget by calling setRootIsDecorated. How do I hide the decorations for the whole tree, not just the root? I've tried QTreeWidgetItem.setChildIndicatorPolicy(QTreeWidgetItem.DontShowIndicator), but this collapses the children, even when I've expanded them. What is setRootIsDecorated doing under the hood to just hide the + / - symbols and nothing else?
    Thank you.

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      you can use a "stylesheet":http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qtreeview to hide the branch-indicators with an invalid/transparent image.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • E Offline
        E Offline
        elveatles
        wrote on last edited by
        #3

        Thanks for your help. I got this working.
        I have a follow-up question. Since it turns out the table doesn't look that great with a blank space there, how would I use the default branch-more.png or branch-end.png as a replacement? When I try putting in the URLs from the example it's still blank. Probably because it can't find the image url.
        I'm extending the interface of a 3rd party application, so I'm trying to figure out how to use their default images rather than make my own .pngs. I thought I might be able to get their existing style sheet by calling the styleSheet() method on my QTreeWidget or maybe its parents, but everything was just empty strings.

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          probably they have set it on the QApplication instance?

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • E Offline
            E Offline
            elveatles
            wrote on last edited by
            #5

            This is what I get from QApplication.instance().styleSheet().
            I guess it would be QApplication::instance()->styleSheet() in C++.

            @
            *{
            selection-color: rgb(0, 0, 0);
            selection-background-color: rgb(37, 200, 25);
            color: white;
            }
            QToolTip{ color: black;}
            *:disabled{color:rgb(30, 30, 30);}
            @
            Looks like they're only changing colors. However, the default Windows 7 expand / collapse icons look like arrows, while the ones I get look like + and - symbols. Not sure if there's an easy way to find where these icons are. Maybe it would make more sense for me to ask their support about that instead.

            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