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

Not getting expand and collapse icons in treeview - Mac



  • Hi, I am not getting expand/collapse icon in tree view on Mac. Windows it works fine. I am using the below settings and also copied the icons in my .app/contents./Macos and resources folders.
    Looks like I am missing something.
    qss file settings:
    Settings:QTreeView {
    show-decoration-selected: 1;
    border: none;
    }

    QTreeView::item {
    border: 1px solid transparent;
    border-top-color: transparent;
    border-bottom-color: transparent;
    }

    QTreeView::item:hover {
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #50667c, stop: 1 #50667c);
    border: 1px solid #50667c;
    }

    QTreeView::item:selected {
    border: 1px solid #50667c;
    }

    QTreeView::item:selected:active{
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #50667c, stop: 1 #50667c);
    }

    QTreeView::item:selected:!active {
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #50667c, stop: 1 #50667c);
    }

    QTreeView::branch:selected:active{
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5a5a5a, stop: 1 #5a5a5a);
    }

    QTreeView::branch:selected:!active {
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5a5a5a, stop: 1 #5a5a5a);
    }

    QTreeView::branch
    {
    border-image: none;
    }
    QTreeView::branch:has-siblings:!adjoins-item {
    border-image: url(vline.png) 0;
    }

    QTreeView::branch:has-siblings:adjoins-item {
    border-image: url(branch-more.png) 0;
    }

    QTreeView::branch:!has-children:!has-siblings:adjoins-item {
    border-image: url(branch-end.png) 0;
    }

    QTreeView::branch:has-children:!has-siblings:closed,
    QTreeView::branch:closed:has-children:has-siblings {
    border-image: none;
    image: url(branch-closed.png);
    }

    QTreeView::branch:open:has-children:!has-siblings,
    QTreeView::branch:open:has-children:has-siblings {
    border-image: none;
    image: url(branch-open.png);
    }


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Your images are likely not found.

    You can use Qt's Resources system to avoid that kind of issue.


Log in to reply