treeview样式表
时间: 2023-08-01 10:13:55 浏览: 178
treeview的实例
根据引用\[1\]和引用\[2\]的内容,可以使用QSS样式表来设置QTreeView的样式。下面是一个示例的QSS样式表:
QTreeView {
border: none;
background: #ad1453;
show-decoration-selected: 1;
}
QTreeView::item {
height: 40px;
}
QTreeView::branch {
background: transparent;
}
QTreeWidget QHeaderView {
color: #1453ad;
}
QTreeView::branch:closed:has-children {
image: url(:/icon/BranchCloseleft.png);
}
QTreeView::branch:open:has-children {
image: url(:/icon/BranchOpenBottom.png);
}
这个样式表可以设置QTreeView的边框为无,背景颜色为#ad1453,选中项的装饰效果为显示。每个项的高度为40像素。树枝的背景为透明。QHeaderView的文字颜色为#1453ad。当树枝关闭且有子项时,显示关闭的图标。当树枝展开且有子项时,显示展开的图标。请注意,这只是一个示例样式表,您可以根据自己的需求进行修改。
#### 引用[.reference_title]
- *1* [QTreeView使用总结8,风格美化,使用qss样式表](https://blog.csdn.net/dpsying/article/details/80271775)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [QTreeView样式表基操作(QSS)](https://blog.csdn.net/weixin_44436546/article/details/109075444)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文