Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved How to change QTreeView Selection background on Indicators (branch)?

    General and Desktop
    2
    3
    761
    Loading More Posts
    • 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.
    • BDC_Patrick
      BDC_Patrick last edited by BDC_Patrick

      Hi there..

      I managed to change the Indicators of children in a TreeView to this:
      1.jpg

      Now, i want to select an Item.. so:
      2.jpg

      Now.. how can i get rid of this white box.. and make it
      A - transparent..
      or if possible
      B - part of the whole blue selection?
      3.jpg

      The whole part of the qss file, of this Widget:

      QTreeView {
          border: 2px solid #373737;
          alternate-background-color: transparent;
          show-decoration-selected: 0;
          background: url(:/Files/img/Tile_FlipFlop_Dark.png) 0;
          selection-background-color: transparent;
      }
      
      QTreeView::branch:has-siblings:!adjoins-item {
          border-image: url(:/Files/img/TreeArrow_vlineHalf.png) 0;
          selection-background-color: transparent;
      }
      
      QTreeView::branch:has-siblings:adjoins-item {
          border-image: url(:/Files/img/TreeArrow_more.png) 0;
          selection-background-color: transparent;
      }
      
      QTreeView::branch:!has-children:!has-siblings:adjoins-item {
          border-image: url(:/Files/img/TreeArrow_end.png) 0;
          selection-background-color: transparent;
      }
      
      QTreeView::branch:has-children:!has-siblings:closed,
      QTreeView::branch:closed:has-children:has-siblings {
          border-image: none;
          image: url(:/Files/img/TreeArrow_closed.png);
          selection-background-color: transparent;
      }
      
      QTreeView::branch:open:has-children:!has-siblings,
      QTreeView::branch:open:has-children:has-siblings  {
          border-image: none;
          image: url(:/Files/img/TreeArrow_open.png);
          selection-background-color: transparent;
      }
      
      QTreeView::item:selected {
          background-color: #547cc5;
          border: 1px solid #4e78a1;
          selection-background-color: transparent;
      }
      
      QTreeView::branch,
      QTreeView::branch:selected,
      QTreeView::branch:selected:active,
      QTreeView::branch:selected:!active {
          alternate-background-color: transparent;
          background-color: transparent;
          border-color: transparent;
          background: none;
          selection-background-color: transparent;
      }
      
      1 Reply Last reply Reply Quote 0
      • BDC_Patrick
        BDC_Patrick last edited by

        I updated the QSS code..
        Still no luck..

        1 Reply Last reply Reply Quote 0
        • B
          bam80 last edited by

          Hi, I think you could try to play with QStyleOptionViewItem::showDecorationSelected or see how it's done in KDE Ark

          1 Reply Last reply Reply Quote 0
          • First post
            Last post