+ self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
+
+class SelectDelegate(QStyledItemDelegate):
+ pass
+
+class NodeNameDelegate(QStyledItemDelegate):
+ def __init__(self, parent):
+ QStyledItemDelegate.__init__(self)
+
+ def paint(self, painter, option, index):
+ data = "%s" % index.data().toString()
+
+# model = index.model()
+# select_index = model.index(index.row(), 2, index.parent())
+# select_data = select_index.data().toString()
+# if select_data == "true":
+# print select_data
+# model.setData(select_index, QString("TEST"), Qt.DisplayRole)
+# model.emit(SIGNAL('dataChanged(QModelIndex, QModelIndex)'),
+# select_index, select_index)
+
+
+ if data.startswith("*"): # already in the sliver
+ data = " %s " % data[1:]
+
+ fm = QFontMetrics(option.font)
+ rect = option.rect
+ rect.setWidth(fm.width(QString(data)))
+ rect.setHeight(rect.height() - 2)
+ rect.setX(rect.x() + 1)
+ x, y, h, w = rect.x(), rect.y(), rect.height(), rect.width()
+
+ path = QPainterPath()
+ path.addRoundedRect(x, y, w, h, 4, 4)
+
+ painter.save()
+ painter.setRenderHint(QPainter.Antialiasing)
+ painter.drawRoundedRect(rect, 4, 4)
+ painter.fillPath(path, QColor.fromRgb(0, 250, 0))
+ painter.setPen(QColor.fromRgb(0, 0, 0))
+ painter.drawText(option.rect, 0, QString(data))
+ painter.restore()
+ else: # others, fall back to default view
+ QStyledItemDelegate.paint(self, painter, option, index)