Debugger/BreakPointModel.py

changeset 2081
b7ccd563eeb6
parent 1928
adde55ed4ce5
child 2126
3744863a534e
equal deleted inserted replaced
2080:4b33165dd55b 2081:b7ccd563eeb6
5 5
6 """ 6 """
7 Module implementing the Breakpoint model. 7 Module implementing the Breakpoint 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 BreakPointModel(QAbstractItemModel): 13 class BreakPointModel(QAbstractItemModel):
14 """ 14 """
15 Class implementing a custom model for breakpoints. 15 Class implementing a custom model for breakpoints.
105 index.row() >= len(self.breakpoints): 105 index.row() >= len(self.breakpoints):
106 return False 106 return False
107 107
108 self.dataAboutToBeChanged.emit(index, index) 108 self.dataAboutToBeChanged.emit(index, index)
109 self.breakpoints[index.row()][index.column()] = value 109 self.breakpoints[index.row()][index.column()] = value
110 self.dataChanged.emit(index, index) 110 if qVersion() >= "5.0.0":
111 self.dataChanged.emit(index, index, [])
112 else:
113 self.dataChanged.emit(index, index)
111 return True 114 return True
112 115
113 def flags(self, index): 116 def flags(self, index):
114 """ 117 """
115 Public method to get item flags. 118 Public method to get item flags.
210 index1 = self.createIndex(row, 0, self.breakpoints[row]) 213 index1 = self.createIndex(row, 0, self.breakpoints[row])
211 index2 = self.createIndex(row, len(self.breakpoints[row]), 214 index2 = self.createIndex(row, len(self.breakpoints[row]),
212 self.breakpoints[row]) 215 self.breakpoints[row])
213 self.dataAboutToBeChanged.emit(index1, index2) 216 self.dataAboutToBeChanged.emit(index1, index2)
214 self.breakpoints[row] = [fn, line] + list(properties) 217 self.breakpoints[row] = [fn, line] + list(properties)
215 self.dataChanged.emit(index1, index2) 218 if qVersion() >= "5.0.0":
219 self.dataChanged.emit(index1, index2, [])
220 else:
221 self.dataChanged.emit(index1, index2)
216 222
217 def setBreakPointEnabledByIndex(self, index, enabled): 223 def setBreakPointEnabledByIndex(self, index, enabled):
218 """ 224 """
219 Public method to set the enabled state of a breakpoint given by index. 225 Public method to set the enabled state of a breakpoint given by index.
220 226
225 row = index.row() 231 row = index.row()
226 col = 4 232 col = 4
227 index1 = self.createIndex(row, col, self.breakpoints[row]) 233 index1 = self.createIndex(row, col, self.breakpoints[row])
228 self.dataAboutToBeChanged.emit(index1, index1) 234 self.dataAboutToBeChanged.emit(index1, index1)
229 self.breakpoints[row][col] = enabled 235 self.breakpoints[row][col] = enabled
230 self.dataChanged.emit(index1, index1) 236 if qVersion() >= "5.0.0":
237 self.dataChanged.emit(index1, index1, [])
238 else:
239 self.dataChanged.emit(index1, index1)
231 240
232 def deleteBreakPointByIndex(self, index): 241 def deleteBreakPointByIndex(self, index):
233 """ 242 """
234 Public method to set the values of a breakpoint given by index. 243 Public method to set the values of a breakpoint given by index.
235 244

eric ide

mercurial