--- a/Debugger/WatchPointModel.py Thu Mar 23 18:58:56 2017 +0100 +++ b/Debugger/WatchPointModel.py Thu Mar 23 19:06:13 2017 +0100 @@ -41,16 +41,16 @@ Qt.Alignment(Qt.AlignRight), ] - def columnCount(self, parent=QModelIndex()): + def columnCount(self, parent=None): """ Public method to get the current column count. - @param parent index of the parent item (QModelIndex) + @param parent index of the parent item (QModelIndex) (Unused) @return column count (integer) """ return len(self.header) - def rowCount(self, parent=QModelIndex()): + def rowCount(self, parent=None): """ Public method to get the current row count. @@ -58,7 +58,7 @@ @return row count (integer) """ # we do not have a tree, parent should always be invalid - if not parent.isValid(): + if parent is None or not parent.isValid(): return len(self.watchpoints) else: return 0 @@ -121,7 +121,7 @@ return None - def index(self, row, column, parent=QModelIndex()): + def index(self, row, column, parent=None): """ Public method to create an index. @@ -130,7 +130,7 @@ @param parent index of the parent item (QModelIndex) @return requested index (QModelIndex) """ - if parent.isValid() or \ + if (parent and parent.isValid()) or \ row < 0 or row >= len(self.watchpoints) or \ column < 0 or column >= len(self.header): return QModelIndex() @@ -146,14 +146,14 @@ """ return QModelIndex() - def hasChildren(self, parent=QModelIndex()): + def hasChildren(self, parent=None): """ Public method to check for the presence of child items. @param parent index of parent item (QModelIndex) @return flag indicating the presence of child items (boolean) """ - if not parent.isValid(): + if parent is None or not parent.isValid(): return len(self.watchpoints) > 0 else: return False