eric6/Debugger/WatchPointModel.py

changeset 8143
2c730d5fd177
parent 8009
29818ac4853c
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
35 self.tr("Special"), 35 self.tr("Special"),
36 self.tr('Temporary'), 36 self.tr('Temporary'),
37 self.tr('Enabled'), 37 self.tr('Enabled'),
38 self.tr('Ignore Count'), 38 self.tr('Ignore Count'),
39 ] 39 ]
40 self.alignments = [Qt.Alignment(Qt.AlignLeft), 40 self.alignments = [Qt.Alignment(Qt.AlignmentFlag.AlignLeft),
41 Qt.Alignment(Qt.AlignLeft), 41 Qt.Alignment(Qt.AlignmentFlag.AlignLeft),
42 Qt.Alignment(Qt.AlignHCenter), 42 Qt.Alignment(Qt.AlignmentFlag.AlignHCenter),
43 Qt.Alignment(Qt.AlignHCenter), 43 Qt.Alignment(Qt.AlignmentFlag.AlignHCenter),
44 Qt.Alignment(Qt.AlignRight), 44 Qt.Alignment(Qt.AlignmentFlag.AlignRight),
45 ] 45 ]
46 46
47 def columnCount(self, parent=None): 47 def columnCount(self, parent=None):
48 """ 48 """
49 Public method to get the current column count. 49 Public method to get the current column count.
75 @return the requested data 75 @return the requested data
76 """ 76 """
77 if not index.isValid(): 77 if not index.isValid():
78 return None 78 return None
79 79
80 if role == Qt.DisplayRole: 80 if role == Qt.ItemDataRole.DisplayRole:
81 if index.column() in [0, 1, 4]: 81 if index.column() in [0, 1, 4]:
82 return self.watchpoints[index.row()][index.column()] 82 return self.watchpoints[index.row()][index.column()]
83 83
84 if role == Qt.CheckStateRole: 84 if role == Qt.ItemDataRole.CheckStateRole:
85 if index.column() in [2, 3]: 85 if index.column() in [2, 3]:
86 return self.watchpoints[index.row()][index.column()] 86 return self.watchpoints[index.row()][index.column()]
87 87
88 if role == Qt.ToolTipRole: 88 if role == Qt.ItemDataRole.ToolTipRole:
89 if index.column() in [0, 1]: 89 if index.column() in [0, 1]:
90 return self.watchpoints[index.row()][index.column()] 90 return self.watchpoints[index.row()][index.column()]
91 91
92 if role == Qt.TextAlignmentRole: 92 if role == Qt.ItemDataRole.TextAlignmentRole:
93 if index.column() < len(self.alignments): 93 if index.column() < len(self.alignments):
94 return self.alignments[index.column()] 94 return self.alignments[index.column()]
95 95
96 return None 96 return None
97 97
101 101
102 @param index index of the requested flags (QModelIndex) 102 @param index index of the requested flags (QModelIndex)
103 @return item flags for the given index (Qt.ItemFlags) 103 @return item flags for the given index (Qt.ItemFlags)
104 """ 104 """
105 if not index.isValid(): 105 if not index.isValid():
106 return Qt.ItemIsEnabled 106 return Qt.ItemFlag.ItemIsEnabled
107 107
108 return Qt.ItemIsEnabled | Qt.ItemIsSelectable 108 return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable
109 109
110 def headerData(self, section, orientation, role=Qt.DisplayRole): 110 def headerData(self, section, orientation,
111 role=Qt.ItemDataRole.DisplayRole):
111 """ 112 """
112 Public method to get header data. 113 Public method to get header data.
113 114
114 @param section section number of the requested header data (integer) 115 @param section section number of the requested header data (integer)
115 @param orientation orientation of the header (Qt.Orientation) 116 @param orientation orientation of the header (Qt.Orientation)
116 @param role role of the requested data (Qt.ItemDataRole) 117 @param role role of the requested data (Qt.ItemDataRole)
117 @return header data 118 @return header data
118 """ 119 """
119 if orientation == Qt.Horizontal and role == Qt.DisplayRole: 120 if (
121 orientation == Qt.Orientation.Horizontal and
122 role == Qt.ItemDataRole.DisplayRole
123 ):
120 if section >= len(self.header): 124 if section >= len(self.header):
121 return "" 125 return ""
122 else: 126 else:
123 return self.header[section] 127 return self.header[section]
124 128

eric ide

mercurial