WebBrowser/History/HistoryFilterModel.py

changeset 5656
9c21b2746218
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
diff -r d75dfc0d10f2 -r 9c21b2746218 WebBrowser/History/HistoryFilterModel.py
--- a/WebBrowser/History/HistoryFilterModel.py	Thu Mar 23 18:58:56 2017 +0100
+++ b/WebBrowser/History/HistoryFilterModel.py	Thu Mar 23 19:06:13 2017 +0100
@@ -169,25 +169,31 @@
         self.__loaded = False
         self.endResetModel()
     
-    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()
+        
         self.__load()
         if parent.isValid():
             return 0
         return len(self.__historyDict)
     
-    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 mapToSource(self, proxyIndex):
@@ -222,7 +228,7 @@
         
         return self.createIndex(row, sourceIndex.column(), sourceOffset)
     
-    def index(self, row, column, parent=QModelIndex()):
+    def index(self, row, column, parent=None):
         """
         Public method to create an index.
         
@@ -231,6 +237,9 @@
         @param parent index of the parent item (QModelIndex)
         @return requested index (QModelIndex)
         """
+        if parent is None:
+            parent = QModelIndex()
+        
         self.__load()
         if row < 0 or row >= self.rowCount(parent) or \
            column < 0 or column >= self.columnCount(parent):
@@ -318,7 +327,7 @@
         """
         self.__sourceReset()
     
-    def removeRows(self, row, count, parent=QModelIndex()):
+    def removeRows(self, row, count, parent=None):
         """
         Public method to remove entries from the model.
         
@@ -327,6 +336,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) or \

eric ide

mercurial