QTreeView problem



  • I have QTreeView/QFileSystemModel derived classes working pretty nicely overall. Seeking help with one cosmetic issue.

    For several reasons I want to hide the little open/close buttons on the left hand side of each QTreeView row. I am able to do this with a stylesheet:

    QTreeView::branch {image: none;}
    

    This works until I (1) select a row of the tree and (2) shift focus away from the QTreeView widget.

    In my case, a selected row with focus is dark blue. When the tree focus is lost, the color of the cells changes to mid-grey EXCEPT for the ::branch area which remains dark blue.

    I have tried a million stylesheet variations but cannot get the branch area colors to mirror those of the rest of row when selected and with/without focus.

    I tried replacing "image: none" with a reference to a 1x1 transparent pixel and get the same thing.

    I do think the behavior has changed a little going from Qt 5.5 to 5.6 too but I don't have a 5.5 available right now for direct comparison.

    It's simple enough to reproduce the problem with the Tree Model Completer Example. Just add:

    treeView->setStyleSheet("QTreeView::branch {image: none;}");
    

    I'm also wondering if you guys think this is worthy of a bug report?


  • Lifetime Qt Champion

    Hi,

    While a unusual use case (to me) I don't see a problem with opening a report about it. The worst case would be that it's closed as invalid but at least it would known.

    Please provide a minimal compilable example with your report.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.