eric7/Debugger/WatchPointModel.py

branch
eric7
changeset 9161
90939b08da20
parent 9160
1675c039a568
equal deleted inserted replaced
9160:1675c039a568 9161:90939b08da20
10 import copy 10 import copy
11 11
12 from PyQt6.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex 12 from PyQt6.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex
13 13
14 14
15 # TODO: change column numbers to class attributes
15 class WatchPointModel(QAbstractItemModel): 16 class WatchPointModel(QAbstractItemModel):
16 """ 17 """
17 Class implementing a custom model for watch expressions. 18 Class implementing a custom model for watch expressions.
18 19
19 @signal dataAboutToBeChanged(QModelIndex, QModelIndex) emitted to indicate 20 @signal dataAboutToBeChanged(QModelIndex, QModelIndex) emitted to indicate
85 86
86 if ( 87 if (
87 role == Qt.ItemDataRole.CheckStateRole and 88 role == Qt.ItemDataRole.CheckStateRole and
88 index.column() in [2, 3] 89 index.column() in [2, 3]
89 ): 90 ):
90 return self.watchpoints[index.row()][index.column()] 91 if self.watchpoints[index.row()][index.column()]:
92 return Qt.CheckState.Checked
93 else:
94 return Qt.CheckState.Unchecked
91 95
92 if ( 96 if (
93 role == Qt.ItemDataRole.ToolTipRole and 97 role == Qt.ItemDataRole.ToolTipRole and
94 index.column() in [0, 1] 98 index.column() in [0, 1]
95 ): 99 ):
223 """ 227 """
224 if index.isValid(): 228 if index.isValid():
225 row = index.row() 229 row = index.row()
226 index1 = self.createIndex(row, 0, self.watchpoints[row]) 230 index1 = self.createIndex(row, 0, self.watchpoints[row])
227 index2 = self.createIndex( 231 index2 = self.createIndex(
228 row, len(self.watchpoints[row]), self.watchpoints[row]) 232 row, len(self.watchpoints[row]) - 1, self.watchpoints[row])
229 self.dataAboutToBeChanged.emit(index1, index2) 233 self.dataAboutToBeChanged.emit(index1, index2)
230 self.watchpoints[row] = [cond, special] + list(properties) 234 self.watchpoints[row] = [cond, special] + list(properties)
231 self.dataChanged.emit(index1, index2) 235 self.dataChanged.emit(index1, index2)
232 236
233 def setWatchPointEnabledByIndex(self, index, enabled): 237 def setWatchPointEnabledByIndex(self, index, enabled):

eric ide

mercurial