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. Changing the color of QTreeView's branches
QtWS25 Last Chance

Changing the color of QTreeView's branches

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 9.0k 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.
  • B Offline
    B Offline
    Byron Lai
    wrote on last edited by
    #1

    I am trying to change the color of a selected item's branch to white

    But the following stylesheet seems not working

    @QTreeView::branch:selected {
    color: white;
    }@

    !http://i.imgur.com/3sntX.png(Branch)!

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      What do you want exactly? Change the color of the selected item's text, or background?

      EDIT : For the selected background you need
      @QTreeView {selection-background-color: white}@

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Byron Lai
        wrote on last edited by
        #3

        No, I want to change the color of the triangle (branch) on the left side of the text

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          I think you need to set the image to draw for the branch, and provide a white triangle image instead of a grey one.

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #5

            Yes, Andre was too fast for me ;)

            You can find examples in the "docs":http://doc.qt.nokia.com/4.7/stylesheet-examples.html#customizing-qtreeview.

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Byron Lai
              wrote on last edited by
              #6

              Thanks Andre and Eddy!
              I will set the image of the branch

              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