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
Forum Updated to NodeBB v4.3 + New Features

Changing the color of QTreeView's branches

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 9.1k 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.
  • B Offline
    B Offline
    Byron Lai
    wrote on 28 Jul 2011, 09:31 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
    • E Offline
      E Offline
      Eddy
      wrote on 28 Jul 2011, 10:13 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 28 Jul 2011, 10:16 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 28 Jul 2011, 10:29 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
          • E Offline
            E Offline
            Eddy
            wrote on 28 Jul 2011, 10:40 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 28 Jul 2011, 10:42 last edited by
              #6

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

              1 Reply Last reply
              0

              1/6

              28 Jul 2011, 09:31

              • Login

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