implement ItemFactory

This commit is contained in:
Martin Baeuml
2011-05-05 17:32:55 +02:00
parent 0963312398
commit 2ba3f9d02f
2 changed files with 10 additions and 45 deletions
+4 -4
View File
@@ -96,12 +96,12 @@ class AnnotationScene(QGraphicsScene):
assert self.root_.isValid()
print "insertItems"
# create a graphics item for each model index
for row in range(first, last+1):
child = self.root_.child(row, 0)
item = AnnotationGraphicsItem.createItem(child)
child = self.root_.child(row, 0) # get index
_type = str(child.data(TypeRole).toPyObject()) # get type from index
item = ItemFactory.createItem(_type, child) # create graphics item from factory
if item is not None:
#checked = (child.data(Qt.CheckStateRole).toInt()[0] == Qt.Checked)
#item.setVisible(checked)
self.addItem(item)
def mode(self):