From edf431533fc427d1cbf4d772517e1f980b1bd34c Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Thu, 5 May 2011 17:30:45 +0200 Subject: [PATCH] add TypeRole, returning the type of an AnnotationModelItem --- annotationmodel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/annotationmodel.py b/annotationmodel.py index 44ff27d..2db5b51 100644 --- a/annotationmodel.py +++ b/annotationmodel.py @@ -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_