def paint(self, painter, option, index):
hasValue = True
if (self.m_editorPrivate):
property = self.m_editorPrivate.indexToProperty(index)
if (property):
hasValue = property.hasValue()
opt = QStyleOptionViewItem(option)
if ((self.m_editorPrivate and index.column() == 0) or not hasValue):
property = self.m_editorPrivate.indexToProperty(index)
if (property and property.isModified()):
opt.font.setBold(True)
opt.fontMetrics = QFontMetrics(opt.font)
c = QColor()
if (not hasValue and self.m_editorPrivate.markPropertiesWithoutValue()):
c = opt.palette.color(QPalette.Dark)
opt.palette.setColor(QPalette.Text, opt.palette.color(QPalette.BrightText))
else:
c = self.m_editorPrivate.calculatedBackgroundColor(self.m_editorPrivate.indexToBrowserItem(index))
if (c.isValid() and (opt.features & QStyleOptionViewItem.Alternate)):
c = c.lighter(112)
if (c.isValid()):
painter.fillRect(option.rect, c)
opt.state &= ~QStyle.State_HasFocus
if (index.column() == 1):
item = self.m_editorPrivate.indexToItem(index)
if (self.m_editedItem and (self.m_editedItem == item)):
self.m_disablePainting = True
super(QtPropertyEditorDelegate, self).paint(painter, opt, index)
if (option.type):
self.m_disablePainting = False
opt.palette.setCurrentColorGroup(QPalette.Active)
color = QApplication.style().styleHint(QStyle.SH_Table_GridLineColor, opt)
painter.save()
painter.setPen(QPen(color))
if (not self.m_editorPrivate or (not self.m_editorPrivate.lastColumn(index.column()) and hasValue)):
if option.direction == Qt.LeftToRight:
right = option.rect.right()
else:
right = option.rect.left()
painter.drawLine(right, option.rect.y(), right, option.rect.bottom())
painter.restore()
qttreepropertybrowser.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录