add TypeRole, returning the type of an AnnotationModelItem

This commit is contained in:
Martin Baeuml
2011-05-05 17:30:45 +02:00
parent 5f65236c3b
commit edf431533f
+3 -1
View File
@@ -4,7 +4,7 @@ from functools import partial
import os.path
import okapy
DataRole, ImageRole = [Qt.UserRole + i for i in range(1,3)]
TypeRole, DataRole, ImageRole = [Qt.UserRole + i + 1 for i in range(3)]
class ModelItem:
def __init__(self, parent=None):
@@ -184,6 +184,8 @@ class AnnotationModelItem(ModelItem):
def data(self, index, role):
if role == Qt.DisplayRole and index.column() == 0:
return self.type()
elif role == TypeRole:
return self.type()
elif role == DataRole:
#print "data():", self.annotation_
return self.annotation_