11 |
11 |
12 class WatchPointModel(QAbstractItemModel): |
12 class WatchPointModel(QAbstractItemModel): |
13 """ |
13 """ |
14 Class implementing a custom model for watch expressions. |
14 Class implementing a custom model for watch expressions. |
15 """ |
15 """ |
|
16 dataAboutToBeChanged = pyqtSignal(QModelIndex, QModelIndex) |
|
17 |
16 def __init__(self, parent = None): |
18 def __init__(self, parent = None): |
17 """ |
19 """ |
18 Constructor |
20 Constructor |
19 |
21 |
20 @param reference to the parent widget (QObject) |
22 @param reference to the parent widget (QObject) |
173 if index.isValid(): |
175 if index.isValid(): |
174 row = index.row() |
176 row = index.row() |
175 index1 = self.createIndex(row, 0, self.watchpoints[row]) |
177 index1 = self.createIndex(row, 0, self.watchpoints[row]) |
176 index2 = self.createIndex(row, len(self.watchpoints[row]), |
178 index2 = self.createIndex(row, len(self.watchpoints[row]), |
177 self.watchpoints[row]) |
179 self.watchpoints[row]) |
178 self.emit(\ |
180 self.dataAboutToBeChanged.emit(index1, index2) |
179 SIGNAL("dataAboutToBeChanged(const QModelIndex &, const QModelIndex &)"), |
|
180 index1, index2) |
|
181 i = 0 |
181 i = 0 |
182 for value in [cond, special] + list(properties): |
182 for value in [cond, special] + list(properties): |
183 self.watchpoints[row][i] = value |
183 self.watchpoints[row][i] = value |
184 i += 1 |
184 i += 1 |
185 self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), |
185 self.dataChanged.emit(index1, index2) |
186 index1, index2) |
|
187 |
186 |
188 def setWatchPointEnabledByIndex(self, index, enabled): |
187 def setWatchPointEnabledByIndex(self, index, enabled): |
189 """ |
188 """ |
190 Public method to set the enabled state of a watch expression given by index. |
189 Public method to set the enabled state of a watch expression given by index. |
191 |
190 |
194 """ |
193 """ |
195 if index.isValid(): |
194 if index.isValid(): |
196 row = index.row() |
195 row = index.row() |
197 col = 3 |
196 col = 3 |
198 index1 = self.createIndex(row, col, self.watchpoints[row]) |
197 index1 = self.createIndex(row, col, self.watchpoints[row]) |
199 self.emit(\ |
198 self.dataAboutToBeChanged.emit(index1, index1) |
200 SIGNAL("dataAboutToBeChanged(const QModelIndex &, const QModelIndex &)"), |
|
201 index1, index1) |
|
202 self.watchpoints[row][col] = enabled |
199 self.watchpoints[row][col] = enabled |
203 self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), |
200 self.dataChanged.emit(index1, index1) |
204 index1, index1) |
|
205 |
201 |
206 def deleteWatchPointByIndex(self, index): |
202 def deleteWatchPointByIndex(self, index): |
207 """ |
203 """ |
208 Public method to set the values of a watch expression given by index. |
204 Public method to set the values of a watch expression given by index. |
209 |
205 |