# eric4.Helpviewer.History.HistoryFilterModel

Module implementing the history filter model.

### Global Attributes

None

### Classes

HistoryData | Class storing some history data.
HistoryFilterModel | Class implementing the history filter model.

### Functions

None

## HistoryData

Class storing some history data.

### Derived from

object

### Class Attributes

None

### Methods

HistoryData | Constructor
__eq__ | Special method implementing equality.
__lt__ | Special method determining less relation.

#### HistoryData (Constructor)

HistoryData(offset, frequency = 0)

Constructor

offset
  tail offset (integer)
frequency
  frequency (integer)

#### HistoryData.__eq__

__eq__(other)

Special method implementing equality.

other
  reference to the object to check against (HistoryData)

Returns:
  flag indicating equality (boolean)

#### HistoryData.__lt__

__lt__(other)

Special method determining less relation.

Note: Like the actual history entries the index mapping is sorted in reverse order by offset

other
  reference to the history data object to compare against (HistoryEntry)

Returns:
  flag indicating less (boolean)

Up

## HistoryFilterModel

Class implementing the history filter model.

### Derived from

QAbstractProxyModel

### Class Attributes

FrequencyRole
MaxRole

### Methods

HistoryFilterModel | Constructor
__frequencyScore | Private method to calculate the frequency score.
__load | Private method to load the model data.
__sourceDataChanged | Private slot to handle the change of data of the source model.
__sourceReset | Private slot to handle a reset of the source model.
__sourceRowsInserted | Private slot to handle the insertion of data in the source model.
__sourceRowsRemoved | Private slot to handle the removal of data in the source model.
columnCount | Public method to get the number of columns.
data | Public method to get data from the model.
headerData | Public method to get the header data.
historyContains | Public method to check the history for an entry.
historyLocation | Public method to get the row number of an entry in the source model.
index | Public method to create an index.
mapFromSource | Public method to map an index to the proxy model index.
mapToSource | Public method to map an index to the source model index.
parent | Public method to get the parent index.
recalculateFrequencies | Public method to recalculate the frequencies.
removeRows | Public method to remove entries from the model.
rowCount | Public method to determine the number of rows.
setSourceModel | Public method to set the source model.

#### HistoryFilterModel (Constructor)

HistoryFilterModel(sourceModel, parent = None)

Constructor

sourceModel
  reference to the source model (QAbstractItemModel)
parent
  reference to the parent object (QObject)

#### HistoryFilterModel.__frequencyScore

__frequencyScore(sourceIndex)

Private method to calculate the frequency score.

sourceIndex
  index of the source model (QModelIndex)

Returns:
  frequency score (integer)

#### HistoryFilterModel.__load

__load()

Private method to load the model data.

#### HistoryFilterModel.__sourceDataChanged

__sourceDataChanged(topLeft, bottomRight)

Private slot to handle the change of data of the source model.

topLeft
  index of top left data element (QModelIndex)
bottomRight
  index of bottom right data element (QModelIndex)

#### HistoryFilterModel.__sourceReset

__sourceReset()

Private slot to handle a reset of the source model.

#### HistoryFilterModel.__sourceRowsInserted

__sourceRowsInserted(parent, start, end)

Private slot to handle the insertion of data in the source model.

parent
  reference to the parent index (QModelIndex)
start
  start row (integer)
end
  end row (integer)

#### HistoryFilterModel.__sourceRowsRemoved

__sourceRowsRemoved(parent, start, end)

Private slot to handle the removal of data in the source model.

parent
  reference to the parent index (QModelIndex)
start
  start row (integer)
end
  end row (integer)

#### HistoryFilterModel.columnCount

columnCount(parent = QModelIndex())

Public method to get the number of columns.

parent
  index of parent (QModelIndex)

Returns:
  number of columns (integer)

#### HistoryFilterModel.data

data(index, role = Qt.DisplayRole)

Public method to get data from the model.

index
  index of history entry to get data for (QModelIndex)
role
  data role (integer)

Returns:
  history entry data (QVariant)

#### HistoryFilterModel.headerData

headerData(section, orientation, role = Qt.DisplayRole)

Public method to get the header data.

section
  section number (integer)
orientation
  header orientation (Qt.Orientation)
role
  data role (integer)

Returns:
  header data (QVariant)

#### HistoryFilterModel.historyContains

historyContains(url)

Public method to check the history for an entry.

url
  URL to check for (QString)

Returns:
  flag indicating success (boolean)

#### HistoryFilterModel.historyLocation

historyLocation(url)

Public method to get the row number of an entry in the source model.

url
  URL to check for (QString)

Returns:
  row number in the source model (integer)

#### HistoryFilterModel.index

index(row, column, parent = QModelIndex())

Public method to create an index.

row
  row number for the index (integer)
column
  column number for the index (integer)
parent
  index of the parent item (QModelIndex)

Returns:
  requested index (QModelIndex)

#### HistoryFilterModel.mapFromSource

mapFromSource(sourceIndex)

Public method to map an index to the proxy model index.

sourceIndex
  reference to a source model index (QModelIndex)

Returns:
  proxy model index (QModelIndex)

#### HistoryFilterModel.mapToSource

mapToSource(proxyIndex)

Public method to map an index to the source model index.

proxyIndex
  reference to a proxy model index (QModelIndex)

Returns:
  source model index (QModelIndex)

#### HistoryFilterModel.parent

parent(index)

Public method to get the parent index.

index
  index of item to get parent (QModelIndex)

Returns:
  index of parent (QModelIndex)

#### HistoryFilterModel.recalculateFrequencies

recalculateFrequencies()

Public method to recalculate the frequencies.

#### HistoryFilterModel.removeRows

removeRows(row, count, parent = QModelIndex())

Public method to remove entries from the model.

row
  row of the first entry to remove (integer)
count
  number of entries to remove (integer)
index
  of the parent entry (QModelIndex)

Returns:
  flag indicating successful removal (boolean)

#### HistoryFilterModel.rowCount

rowCount(parent = QModelIndex())

Public method to determine the number of rows.

parent
  index of parent (QModelIndex)

Returns:
  number of rows (integer)

#### HistoryFilterModel.setSourceModel

setSourceModel(sourceModel)

Public method to set the source model.

sourceModel
  reference to the source model (QAbstractItemModel)

Up