Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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



  • 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;
    }
    


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


Log in to reply