Debugger/BreakPointModel.py

changeset 5656
9c21b2746218
parent 5389
9b1c800daff3
child 5726
e1dbd217214a
--- a/Debugger/BreakPointModel.py	Thu Mar 23 18:58:56 2017 +0100
+++ b/Debugger/BreakPointModel.py	Thu Mar 23 19:06:13 2017 +0100
@@ -44,16 +44,16 @@
                            Qt.Alignment(Qt.AlignHCenter),
                            ]
 
-    def columnCount(self, parent=QModelIndex()):
+    def columnCount(self, parent=None):
         """
         Public method to get the current column count.
         
-        @param parent reference to parent index (QModelIndex)
+        @param parent reference to parent index (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.
         
@@ -61,7 +61,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.breakpoints)
         else:
             return 0
@@ -143,7 +143,7 @@
         
         return None
     
-    def index(self, row, column, parent=QModelIndex()):
+    def index(self, row, column, parent=None):
         """
         Public method to create an index.
         
@@ -152,7 +152,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.breakpoints) or \
            column < 0 or column >= len(self.header):
             return QModelIndex()
@@ -168,14 +168,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.breakpoints) > 0
         else:
             return False

eric ide

mercurial