Debugger/WatchPointModel.py

changeset 7
c679fb30c8f3
parent 0
de9c2efb9d02
child 13
1af94a91f439
equal deleted inserted replaced
6:52e8c820d0dd 7:c679fb30c8f3
21 """ 21 """
22 QObject.__init__(self, parent) 22 QObject.__init__(self, parent)
23 23
24 self.watchpoints = [] 24 self.watchpoints = []
25 self.header = [ 25 self.header = [
26 QVariant(self.trUtf8("Condition")), 26 self.trUtf8("Condition"),
27 QVariant(self.trUtf8("Special")), 27 self.trUtf8("Special"),
28 QVariant(self.trUtf8('Temporary')), 28 self.trUtf8('Temporary'),
29 QVariant(self.trUtf8('Enabled')), 29 self.trUtf8('Enabled'),
30 QVariant(self.trUtf8('Ignore Count')), 30 self.trUtf8('Ignore Count'),
31 ] 31 ]
32 self.alignments = [QVariant(Qt.Alignment(Qt.AlignLeft)), 32 self.alignments = [Qt.Alignment(Qt.AlignLeft),
33 QVariant(Qt.Alignment(Qt.AlignLeft)), 33 Qt.Alignment(Qt.AlignLeft),
34 QVariant(Qt.Alignment(Qt.AlignHCenter)), 34 Qt.Alignment(Qt.AlignHCenter),
35 QVariant(Qt.Alignment(Qt.AlignHCenter)), 35 Qt.Alignment(Qt.AlignHCenter),
36 QVariant(Qt.Alignment(Qt.AlignRight)), 36 Qt.Alignment(Qt.AlignRight),
37 ] 37 ]
38 38
39 def columnCount(self, parent = QModelIndex()): 39 def columnCount(self, parent = QModelIndex()):
40 """ 40 """
41 Public method to get the current column count. 41 Public method to get the current column count.
60 """ 60 """
61 Public method to get the requested data. 61 Public method to get the requested data.
62 62
63 @param index index of the requested data (QModelIndex) 63 @param index index of the requested data (QModelIndex)
64 @param role role of the requested data (Qt.ItemDataRole) 64 @param role role of the requested data (Qt.ItemDataRole)
65 @return the requested data (QVariant) 65 @return the requested data
66 """ 66 """
67 if not index.isValid(): 67 if not index.isValid():
68 return QVariant() 68 return None
69 69
70 if role == Qt.DisplayRole or role == Qt.ToolTipRole: 70 if role == Qt.DisplayRole or role == Qt.ToolTipRole:
71 if index.column() < len(self.header): 71 if index.column() < len(self.header):
72 return QVariant(self.watchpoints[index.row()][index.column()]) 72 return self.watchpoints[index.row()][index.column()]
73 73
74 if role == Qt.TextAlignmentRole: 74 if role == Qt.TextAlignmentRole:
75 if index.column() < len(self.alignments): 75 if index.column() < len(self.alignments):
76 return self.alignments[index.column()] 76 return self.alignments[index.column()]
77 77
78 return QVariant() 78 return None
79 79
80 def flags(self, index): 80 def flags(self, index):
81 """ 81 """
82 Public method to get item flags. 82 Public method to get item flags.
83 83
94 Public method to get header data. 94 Public method to get header data.
95 95
96 @param section section number of the requested header data (integer) 96 @param section section number of the requested header data (integer)
97 @param orientation orientation of the header (Qt.Orientation) 97 @param orientation orientation of the header (Qt.Orientation)
98 @param role role of the requested data (Qt.ItemDataRole) 98 @param role role of the requested data (Qt.ItemDataRole)
99 @return header data (QVariant) 99 @return header data
100 """ 100 """
101 if orientation == Qt.Horizontal and role == Qt.DisplayRole: 101 if orientation == Qt.Horizontal and role == Qt.DisplayRole:
102 if section >= len(self.header): 102 if section >= len(self.header):
103 return QVariant("") 103 return ""
104 else: 104 else:
105 return self.header[section] 105 return self.header[section]
106 106
107 return QVariant() 107 return None
108 108
109 def index(self, row, column, parent = QModelIndex()): 109 def index(self, row, column, parent = QModelIndex()):
110 """ 110 """
111 Public method to create an index. 111 Public method to create an index.
112 112

eric ide

mercurial