def paint(self, painter, option, widget): pen = getDefaultExpressionPen() rpen = Shapes.getDefaultPen(True) font = Shapes.getDefaultFont() brush = Shapes.getDefaultForeBrush() m = getDefaultExpressionListMargin() b = self.boundingRect().adjusted(0, 0, m, m) pen.setWidthF(2.0) painter.scale(1, -1) painter.setPen(rpen) painter.setFont(font) painter.setBrush(self.bg) painter.drawRect(b) painter.setPen(pen) painter.setBrush(brush) h = m/2 for i in self.tree: b = i.boundingRect(font) i.paint(painter, font, -b.left() + m/2, h + b.height()/2); h += b.height()
def getDefaultExpressionPen(): pen = Shapes.getDefaultPen() pen.setWidthF(1.0) return pen