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 |
10 from PyQt4.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex, qVersion |
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 self.dataChanged.emit(index1, index2) |
194 if qVersion() >= "5.0.0": |
|
195 self.dataChanged.emit(index1, index2, []) |
|
196 else: |
|
197 self.dataChanged.emit(index1, index2) |
195 |
198 |
196 def setWatchPointEnabledByIndex(self, index, enabled): |
199 def setWatchPointEnabledByIndex(self, index, enabled): |
197 """ |
200 """ |
198 Public method to set the enabled state of a watch expression given by index. |
201 Public method to set the enabled state of a watch expression given by index. |
199 |
202 |
204 row = index.row() |
207 row = index.row() |
205 col = 3 |
208 col = 3 |
206 index1 = self.createIndex(row, col, self.watchpoints[row]) |
209 index1 = self.createIndex(row, col, self.watchpoints[row]) |
207 self.dataAboutToBeChanged.emit(index1, index1) |
210 self.dataAboutToBeChanged.emit(index1, index1) |
208 self.watchpoints[row][col] = enabled |
211 self.watchpoints[row][col] = enabled |
209 self.dataChanged.emit(index1, index1) |
212 if qVersion() >= "5.0.0": |
|
213 self.dataChanged.emit(index1, index1, []) |
|
214 else: |
|
215 self.dataChanged.emit(index1, index1) |
210 |
216 |
211 def deleteWatchPointByIndex(self, index): |
217 def deleteWatchPointByIndex(self, index): |
212 """ |
218 """ |
213 Public method to set the values of a watch expression given by index. |
219 Public method to set the values of a watch expression given by index. |
214 |
220 |