zhonghua

C++博客 首页 新随笔 联系 聚合 管理
  72 Posts :: 1 Stories :: 4 Comments :: 0 Trackbacks

//如果设置 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);
posted on 2012-07-20 12:13 米米 阅读(2057) 评论(0)  编辑 收藏 引用 所属分类: qt

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理