Debugger/WatchPointModel.py

changeset 5656
9c21b2746218
parent 5389
9b1c800daff3
child 5726
e1dbd217214a
equal deleted inserted replaced
5654:d75dfc0d10f2 5656:9c21b2746218
39 Qt.Alignment(Qt.AlignHCenter), 39 Qt.Alignment(Qt.AlignHCenter),
40 Qt.Alignment(Qt.AlignHCenter), 40 Qt.Alignment(Qt.AlignHCenter),
41 Qt.Alignment(Qt.AlignRight), 41 Qt.Alignment(Qt.AlignRight),
42 ] 42 ]
43 43
44 def columnCount(self, parent=QModelIndex()): 44 def columnCount(self, parent=None):
45 """ 45 """
46 Public method to get the current column count. 46 Public method to get the current column count.
47 47
48 @param parent index of the parent item (QModelIndex) 48 @param parent index of the parent item (QModelIndex) (Unused)
49 @return column count (integer) 49 @return column count (integer)
50 """ 50 """
51 return len(self.header) 51 return len(self.header)
52 52
53 def rowCount(self, parent=QModelIndex()): 53 def rowCount(self, parent=None):
54 """ 54 """
55 Public method to get the current row count. 55 Public method to get the current row count.
56 56
57 @param parent index of the parent item (QModelIndex) 57 @param parent index of the parent item (QModelIndex)
58 @return row count (integer) 58 @return row count (integer)
59 """ 59 """
60 # we do not have a tree, parent should always be invalid 60 # we do not have a tree, parent should always be invalid
61 if not parent.isValid(): 61 if parent is None or not parent.isValid():
62 return len(self.watchpoints) 62 return len(self.watchpoints)
63 else: 63 else:
64 return 0 64 return 0
65 65
66 def data(self, index, role): 66 def data(self, index, role):
119 else: 119 else:
120 return self.header[section] 120 return self.header[section]
121 121
122 return None 122 return None
123 123
124 def index(self, row, column, parent=QModelIndex()): 124 def index(self, row, column, parent=None):
125 """ 125 """
126 Public method to create an index. 126 Public method to create an index.
127 127
128 @param row row number for the index (integer) 128 @param row row number for the index (integer)
129 @param column column number for the index (integer) 129 @param column column number for the index (integer)
130 @param parent index of the parent item (QModelIndex) 130 @param parent index of the parent item (QModelIndex)
131 @return requested index (QModelIndex) 131 @return requested index (QModelIndex)
132 """ 132 """
133 if parent.isValid() or \ 133 if (parent and parent.isValid()) or \
134 row < 0 or row >= len(self.watchpoints) or \ 134 row < 0 or row >= len(self.watchpoints) or \
135 column < 0 or column >= len(self.header): 135 column < 0 or column >= len(self.header):
136 return QModelIndex() 136 return QModelIndex()
137 137
138 return self.createIndex(row, column, self.watchpoints[row]) 138 return self.createIndex(row, column, self.watchpoints[row])
144 @param index index of item to get parent (QModelIndex) 144 @param index index of item to get parent (QModelIndex)
145 @return index of parent (QModelIndex) 145 @return index of parent (QModelIndex)
146 """ 146 """
147 return QModelIndex() 147 return QModelIndex()
148 148
149 def hasChildren(self, parent=QModelIndex()): 149 def hasChildren(self, parent=None):
150 """ 150 """
151 Public method to check for the presence of child items. 151 Public method to check for the presence of child items.
152 152
153 @param parent index of parent item (QModelIndex) 153 @param parent index of parent item (QModelIndex)
154 @return flag indicating the presence of child items (boolean) 154 @return flag indicating the presence of child items (boolean)
155 """ 155 """
156 if not parent.isValid(): 156 if parent is None or not parent.isValid():
157 return len(self.watchpoints) > 0 157 return len(self.watchpoints) > 0
158 else: 158 else:
159 return False 159 return False
160 160
161 ########################################################################### 161 ###########################################################################

eric ide

mercurial