5 |
5 |
6 """ |
6 """ |
7 Module implementing the Watch expression model. |
7 Module implementing the Watch expression model. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex, qVersion |
10 from PyQt4.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex |
11 |
11 |
12 |
12 |
13 class WatchPointModel(QAbstractItemModel): |
13 class WatchPointModel(QAbstractItemModel): |
14 """ |
14 """ |
15 Class implementing a custom model for watch expressions. |
15 Class implementing a custom model for watch expressions. |
189 self.dataAboutToBeChanged.emit(index1, index2) |
189 self.dataAboutToBeChanged.emit(index1, index2) |
190 i = 0 |
190 i = 0 |
191 for value in [cond, special] + list(properties): |
191 for value in [cond, special] + list(properties): |
192 self.watchpoints[row][i] = value |
192 self.watchpoints[row][i] = value |
193 i += 1 |
193 i += 1 |
194 if qVersion() >= "5.0.0": |
194 self.dataChanged.emit(index1, index2) |
195 self.dataChanged.emit(index1, index2, []) |
|
196 else: |
|
197 self.dataChanged.emit(index1, index2) |
|
198 |
195 |
199 def setWatchPointEnabledByIndex(self, index, enabled): |
196 def setWatchPointEnabledByIndex(self, index, enabled): |
200 """ |
197 """ |
201 Public method to set the enabled state of a watch expression given by index. |
198 Public method to set the enabled state of a watch expression given by index. |
202 |
199 |
207 row = index.row() |
204 row = index.row() |
208 col = 3 |
205 col = 3 |
209 index1 = self.createIndex(row, col, self.watchpoints[row]) |
206 index1 = self.createIndex(row, col, self.watchpoints[row]) |
210 self.dataAboutToBeChanged.emit(index1, index1) |
207 self.dataAboutToBeChanged.emit(index1, index1) |
211 self.watchpoints[row][col] = enabled |
208 self.watchpoints[row][col] = enabled |
212 if qVersion() >= "5.0.0": |
209 self.dataChanged.emit(index1, index1) |
213 self.dataChanged.emit(index1, index1, []) |
|
214 else: |
|
215 self.dataChanged.emit(index1, index1) |
|
216 |
210 |
217 def deleteWatchPointByIndex(self, index): |
211 def deleteWatchPointByIndex(self, index): |
218 """ |
212 """ |
219 Public method to set the values of a watch expression given by index. |
213 Public method to set the values of a watch expression given by index. |
220 |
214 |