# eric7.WebBrowser.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

None

### Class Attributes

None

### Class Methods

None

### Methods

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

### Static Methods

None

#### HistoryData (Constructor)

HistoryData(offset, frequency=0)

Constructor

offset (int)
  tail offset
frequency (int)
  frequency

#### HistoryData.__eq__

__eq__(other)

Special method implementing equality.

other (HistoryData)
  reference to the object to check against

Return:
  flag indicating equality

Return Type:
  bool

#### 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 (HistoryEntry)
  reference to the history data object to compare against

Return:
  flag indicating less

Return Type:
  bool

Up

## HistoryFilterModel

Class implementing the history filter model.

### Derived from

QAbstractProxyModel

### Class Attributes

FrequencyRole
MaxRole

### Class Methods

None

### 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.

### Static Methods

None

#### HistoryFilterModel (Constructor)

HistoryFilterModel(sourceModel, parent=None)

Constructor

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

#### HistoryFilterModel.__frequencyScore

__frequencyScore(sourceIndex)

Private method to calculate the frequency score.

sourceIndex (QModelIndex)
  index of the source model

Return:
  frequency score

Return Type:
  int

#### 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 (QModelIndex)
  index of top left data element
bottomRight (QModelIndex)
  index of bottom right data element

#### 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 (QModelIndex)
  reference to the parent index
start (int)
  start row
end (int)
  end row

#### HistoryFilterModel.__sourceRowsRemoved

__sourceRowsRemoved(parent, start, end)

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

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

#### HistoryFilterModel.columnCount

columnCount(parent=None)

Public method to get the number of columns.

parent (QModelIndex)
  index of parent

Return:
  number of columns

Return Type:
  int

#### HistoryFilterModel.data

data(index, role=Qt.ItemDataRole.DisplayRole)

Public method to get data from the model.

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

Return:
  history entry data

Return Type:
  Any

#### HistoryFilterModel.headerData

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

Public method to get the header data.

section (int)
  section number
orientation (Qt.Orientation)
  header orientation
role (Qt.ItemDataRole)
  data role

Return:
  header data

Return Type:
  Any

#### HistoryFilterModel.historyContains

historyContains(url)

Public method to check the history for an entry.

url (str)
  URL to check for

Return:
  flag indicating success

Return Type:
  bool

#### HistoryFilterModel.historyLocation

historyLocation(url)

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

url (str)
  URL to check for

Return:
  row number in the source model

Return Type:
  int

#### HistoryFilterModel.index

index(row, column, parent=None)

Public method to create an index.

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

Return:
  requested index

Return Type:
  QModelIndex

#### HistoryFilterModel.mapFromSource

mapFromSource(sourceIndex)

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

sourceIndex (QModelIndex)
  reference to a source model index

Return:
  proxy model index

Return Type:
  QModelIndex

#### HistoryFilterModel.mapToSource

mapToSource(proxyIndex)

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

proxyIndex (QModelIndex)
  reference to a proxy model index

Return:
  source model index

Return Type:
  QModelIndex

#### HistoryFilterModel.parent

parent(_index)

Public method to get the parent index.

_index (QModelIndex)
  index of item to get parent (unused)

Return:
  index of parent

Return Type:
  QModelIndex

#### HistoryFilterModel.recalculateFrequencies

recalculateFrequencies()

Public method to recalculate the frequencies.

#### HistoryFilterModel.removeRows

removeRows(row, count, parent=None)

Public method to remove entries from the model.

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

Return:
  flag indicating successful removal

Return Type:
  bool

#### HistoryFilterModel.rowCount

rowCount(parent=None)

Public method to determine the number of rows.

parent (QModelIndex)
  index of parent

Return:
  number of rows

Return Type:
  int

#### HistoryFilterModel.setSourceModel

setSourceModel(sourceModel)

Public method to set the source model.

sourceModel (QAbstractItemModel)
  reference to the source model

Up