--- a/Helpviewer/History/HistoryFilterModel.py Thu Mar 23 18:58:56 2017 +0100 +++ b/Helpviewer/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 \