def drawIndicatorIcon(palette, style):
pix = QPixmap(14, 14)
pix.fill(Qt.transparent)
branchOption = QStyleOption()
#r = QRect(QPoint(0, 0), pix.size())
branchOption.rect = QRect(2, 2, 9, 9) ## ### hardcoded in qcommonstyle.cpp
branchOption.palette = palette
branchOption.state = QStyle.State_Children
p = QPainter()
## Draw closed state
p.begin(pix)
style.drawPrimitive(QStyle.PE_IndicatorBranch, branchOption, p)
p.end()
rc = QIcon(pix)
rc.addPixmap(pix, QIcon.Selected, QIcon.Off)
## Draw opened state
branchOption.state |= QStyle.State_Open
pix.fill(Qt.transparent)
p.begin(pix)
style.drawPrimitive(QStyle.PE_IndicatorBranch, branchOption, p)
p.end()
rc.addPixmap(pix, QIcon.Normal, QIcon.On)
rc.addPixmap(pix, QIcon.Selected, QIcon.On)
return rc
qttreepropertybrowser.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录