QTreeview 选中后 branch区域背景为高亮的橙色.

 

//如果设置 show-decoration-selected:1会导致点击选中后,前面branch区域背景为高亮的橙色.

    ui->treeView->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff ) ;

              ui->treeView->setStyleSheet(   \
                      " QTreeView { \
                                    show-decoration-selected: 0; \
                                } \
                                \
                                QTreeView::item { \
                                    show-decoration-selected: 0; \
                                    background-image:url(image/list_bg02.png); \
                                } \
                                QTreeView::item:selected{ \
                                    background-image:url(image/list_bg01a.png); \
                                }  \
             QTreeView::branch { \
                      selection-color: transparent; \
              } \
              QTreeView::branch:closed:has-children:has-siblings { \
                      image: url(image/icon_add.png); \
              } \
               \
              QTreeView::branch:has-children:!has-siblings:closed { \
                      image: url(image/icon_add.png); \
              } \
               \
              QTreeView::branch:open:has-children:has-siblings { \
                      image: url(image/icon_reduce.png); \
              } \
\
              QTreeView::branch:open:has-children:!has-siblings { \
                      image: url(image/icon_reduce.png); \
              }");

 


    ui->treeView->setAttribute(Qt::WA_MacShowFocusRect, 0);
    ui->treeView->setFocusPolicy(Qt::NoFocus);
    ui->treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);

你可能感兴趣的:(image,url,qt,branch)