qt qtreewidget下拉箭头样式
时间: 2023-09-03 19:15:49 浏览: 299
QT树节点拖拽,支持两个QTreewidget相互拖拽
您可以使用QSS(Qt样式表)来更改QTreeWidget下拉箭头的样式。以下是一个示例:
```
QTreeView::branch:has-siblings:!adjoins-item {
border-image: url(path/to/arrow.png) 0;
}
QTreeView::branch:has-siblings:adjoins-item {
border-image: url(path/to/arrow-bottom.png) 0;
}
QTreeView::branch:!has-children:!has-siblings:adjoins-item {
border-image: url(path/to/arrow-right.png) 0;
}
QTreeView::branch:has-children:!has-siblings:closed,
QTreeView::branch:closed:has-children:has-siblings {
border-image: none;
image: url(path/to/arrow-right.png);
}
QTreeView::branch:open:has-children:has-siblings,
QTreeView::branch:open:has-children:!has-siblings {
border-image: none;
image: url(path/to/arrow-bottom.png);
}
QTreeView::branch:closed:has-children:!has-siblings {
border-image: none;
image: url(path/to/arrow-right.png);
}
```
在这个例子中,我们使用了五个CSS选择器来改变QTreeWidget下拉箭头的样式。您需要将箭头图像的路径替换为您自己的路径。
阅读全文