Helpviewer/History/HistoryFilterModel.py

changeset 3656
441956d8fce5
parent 3178
f25fc1364c88
child 4021
195a471c327b
equal deleted inserted replaced
3654:ffeb85cdc72d 3656:441956d8fce5
7 Module implementing the history filter model. 7 Module implementing the history filter model.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt4.QtCore import Qt, QDateTime, QModelIndex 12 from PyQt5.QtCore import Qt, QDateTime, QModelIndex, QAbstractProxyModel
13 from PyQt4.QtGui import QAbstractProxyModel
14 13
15 from .HistoryModel import HistoryModel 14 from .HistoryModel import HistoryModel
16 15
17 16
18 class HistoryData(object): 17 class HistoryData(object):
164 163
165 def __sourceReset(self): 164 def __sourceReset(self):
166 """ 165 """
167 Private slot to handle a reset of the source model. 166 Private slot to handle a reset of the source model.
168 """ 167 """
168 self.beginResetModel()
169 self.__loaded = False 169 self.__loaded = False
170 self.reset() 170 self.endResetModel()
171 171
172 def rowCount(self, parent=QModelIndex()): 172 def rowCount(self, parent=QModelIndex()):
173 """ 173 """
174 Public method to determine the number of rows. 174 Public method to determine the number of rows.
175 175
344 self.sourceModel().removeRows(start, end - start + 1) 344 self.sourceModel().removeRows(start, end - start + 1)
345 self.endRemoveRows() 345 self.endRemoveRows()
346 self.sourceModel().rowsRemoved.connect(self.__sourceRowsRemoved) 346 self.sourceModel().rowsRemoved.connect(self.__sourceRowsRemoved)
347 self.__loaded = False 347 self.__loaded = False
348 if oldCount - count != self.rowCount(): 348 if oldCount - count != self.rowCount():
349 self.reset() 349 self.beginResetModel()
350 self.endResetModel()
350 return True 351 return True
351 352
352 def __frequencyScore(self, sourceIndex): 353 def __frequencyScore(self, sourceIndex):
353 """ 354 """
354 Private method to calculate the frequency score. 355 Private method to calculate the frequency score.

eric ide

mercurial