Results 1 to 1 of 1

Thread: QTreeView item icon issue

  1. #1
    Join Date
    Jun 2018
    Posts
    2
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: QTreeView item icon issue

    I am facing and issue while setting tree view icon. It is setting at wrong place. I am using style-sheet.

    I want something like second image.. Image with plus as an file extension.

    tree_style = """
    QTreeView {
    background: #EBFEF4;
    show-decoration-selected: 1;
    }

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

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

    QTreeView::item:selected {
    border: 1px solid #567dbc;
    }

    QTreeView::item:selected:active{
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
    }

    QTreeView::item:selected:!active {
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
    }


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

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

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

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

    QTreeView::branchpen:has-children:!has-siblings,
    QTreeView::branchpen:has-children:has-siblings {
    border-image: none;
    image: url(:/.png/FolderOpen.png);
    }
    """


    Added after 6 minutes:


    I did this
    QTreeView {
    background: #EBFEF4;
    show-decoration-selected: 1;
    }

    QTreeView::item {
    border: 1px solid #d9d9d9;
    border-top-color: transparent;
    border-bottom-color: transparent;
    image: url(:/.png/FolderClosed.png);
    }

    So icon came at right side.. But I want icon at left most side.
    Attached Images Attached Images
    Last edited by Binit Amin; 1st June 2018 at 09:16.

Similar Threads

  1. Replies: 0
    Last Post: 25th January 2015, 05:23
  2. How to show two icon in QTreeView
    By Pardeep in forum Newbie
    Replies: 7
    Last Post: 11th February 2013, 14:52
  3. QTreeView with varying icon size
    By Thuan Seah Tan in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2012, 09:57
  4. Add icon to the right in a QTreeView
    By hubbobubbo in forum Qt Programming
    Replies: 3
    Last Post: 21st April 2010, 20:01
  5. QTreeView ICON
    By Raymond in forum Qt Programming
    Replies: 2
    Last Post: 28th October 2009, 03:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.