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. How to change QTreeView Selection background on Indicators (branch)?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.6k 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
    BDC_Patrick
    wrote on 30 Aug 2020, 16:42 last edited by BDC_Patrick 9 Jan 2020, 12:08
    #1

    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
    0
    • B Offline
      B Offline
      BDC_Patrick
      wrote on 1 Sept 2020, 12:05 last edited by
      #2

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

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bam80
        wrote on 30 Apr 2022, 23:50 last edited by
        #3

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

        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