class ResultModel QAbstractItemModel Model def __init__ self self cont

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class ResultModel(QAbstractItemModel):
"""
Model
"""
def __init__(self):
self.cont = ResultContainer()
super(ResultModel, self).__init__()
def data(self, index, role = Qt.DisplayRole):
if not index.isValid():
return QVariant()
col = index.column()
row = index.row()
if role == Qt.DisplayRole:
#Get data to row
item = self.cont.getData4Row(row)
# Icon set
if col == 0:
return self.cont.iconSet()
return QVariant(item(col))
return QVariant()
def rowCount(self, index=QModelIndex()):
return self.cont.resCount()
def columnCount(self, index=QModelIndex()):
return 5