天天看點

QSS祛除QTreeView虛線框用法

祛除QTreeView的虛線框,主要在QSS中,用outline:none,用法:QTreeView{outline:none}。

1.1下面是一個具體的應用用法:

recoveryTreeView->setStyleSheet("QTreeView{background-color: transparent;color:white;font: bold 14px;outline:none;}"
                                    "QTreeView::branch:open:has-children:!has-siblings,"
                                    "QTreeView::branch:open:has-children:has-siblings {image: url(:res/recoverydata/icon/icon_list_2.png);}"
                                    "QTreeView::branch:has-children:!has-siblings:closed,"
                                    "QTreeView::branch:closed:has-children:has-siblings {image: url(:res/recoverydata/icon/icon_list_1.png);}"
                                    "QTreeView::item:hover {background-color:rgb(8,52,127);}"
                                    "QTreeView::item:selected {background-color:rgb(8,52,127);border:1px solid #08347F;}");
           

1.2實作效果圖:

QSS祛除QTreeView虛線框用法

沒有虛線框的效果圖

QSS祛除QTreeView虛線框用法

有虛線框的效果圖

參考内容:

https://blog.csdn.net/hk2291976/article/details/27210541

https://blog.csdn.net/zhango5/article/details/79163841(有用)

繼續閱讀