Helpviewer/History/HistoryTreeModel.py

changeset 5656
9c21b2746218
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
--- a/Helpviewer/History/HistoryTreeModel.py	Thu Mar 23 18:58:56 2017 +0100
+++ b/Helpviewer/History/HistoryTreeModel.py	Thu Mar 23 19:06:13 2017 +0100
@@ -82,22 +82,28 @@
         
         return QAbstractProxyModel.data(self, index, role)
     
-    def columnCount(self, parent=QModelIndex()):
+    def columnCount(self, parent=None):
         """
         Public method to get the number of columns.
         
         @param parent index of parent (QModelIndex)
         @return number of columns (integer)
         """
+        if parent is None:
+            parent = QModelIndex()
+        
         return self.sourceModel().columnCount(self.mapToSource(parent))
     
-    def rowCount(self, parent=QModelIndex()):
+    def rowCount(self, parent=None):
         """
         Public method to determine the number of rows.
         
         @param parent index of parent (QModelIndex)
         @return number of rows (integer)
         """
+        if parent is None:
+            parent = QModelIndex()
+        
         if parent.internalId() != 0 or \
            parent.column() > 0 or \
            self.sourceModel() is None:
@@ -161,7 +167,7 @@
         return self.sourceModel().index(
             startDateRow + proxyIndex.row(), proxyIndex.column())
     
-    def index(self, row, column, parent=QModelIndex()):
+    def index(self, row, column, parent=None):
         """
         Public method to create an index.
         
@@ -170,6 +176,9 @@
         @param parent index of the parent item (QModelIndex)
         @return requested index (QModelIndex)
         """
+        if parent is None:
+            parent = QModelIndex()
+        
         if row < 0 or \
            column < 0 or \
            column >= self.columnCount(parent) or \
@@ -192,13 +201,16 @@
             return QModelIndex()
         return self.createIndex(offset - 1, 0, 0)
     
-    def hasChildren(self, parent=QModelIndex()):
+    def hasChildren(self, parent=None):
         """
         Public method to check, if an entry has some children.
         
         @param parent index of the entry to check (QModelIndex)
         @return flag indicating the presence of children (boolean)
         """
+        if parent is None:
+            parent = QModelIndex()
+        
         grandparent = parent.parent()
         if not grandparent.isValid():
             return True
@@ -299,7 +311,7 @@
         row = sourceIndex.row() - self.__sourceRowCache[dateRow]
         return self.createIndex(row, sourceIndex.column(), dateRow + 1)
     
-    def removeRows(self, row, count, parent=QModelIndex()):
+    def removeRows(self, row, count, parent=None):
         """
         Public method to remove entries from the model.
         
@@ -308,6 +320,9 @@
         @param parent index of the parent entry (QModelIndex)
         @return flag indicating successful removal (boolean)
         """
+        if parent is None:
+            parent = QModelIndex()
+        
         if row < 0 or \
            count <= 0 or \
            row + count > self.rowCount(parent):

eric ide

mercurial