# eric7.WebBrowser.History.HistoryTreeModel

Module implementing the history tree model.

### Global Attributes

None

### Classes

HistoryTreeModel | Class implementing the history tree model.

### Functions

None

## HistoryTreeModel

Class implementing the history tree model.

### Derived from

QAbstractProxyModel

### Class Attributes

None

### Class Methods

None

### Methods

HistoryTreeModel | Constructor
__sourceDateRow | Private method to translate the top level date row into the offset where that date starts.
__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.
flags | Public method to get the item flags.
hasChildren | Public method to check, if an entry has some children.
headerData | Public method to get the header data.
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.
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

#### HistoryTreeModel (Constructor)

HistoryTreeModel(sourceModel, parent=None)

Constructor

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

#### HistoryTreeModel.__sourceDateRow

__sourceDateRow(row)

Private method to translate the top level date row into the offset where that date starts.

row
  row number of the date (integer)

Return:
  offset where that date starts (integer)

#### HistoryTreeModel.__sourceReset

__sourceReset()

Private slot to handle a reset of the source model.

#### HistoryTreeModel.__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)

#### HistoryTreeModel.__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)

#### HistoryTreeModel.columnCount

columnCount(parent=None)

Public method to get the number of columns.

parent
  index of parent (QModelIndex)

Return:
  number of columns (integer)

#### HistoryTreeModel.data

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

Public method to get data from the model.

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

Return:
  history entry data

#### HistoryTreeModel.flags

flags(index)

Public method to get the item flags.

index
  index of the item (QModelIndex)

Return:
  flags (Qt.ItemFlags)

#### HistoryTreeModel.hasChildren

hasChildren(parent=None)

Public method to check, if an entry has some children.

parent
  index of the entry to check (QModelIndex)

Return:
  flag indicating the presence of children (boolean)

#### HistoryTreeModel.headerData

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

Public method to get the header data.

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

Return:
  header data

#### HistoryTreeModel.index

index(row, column, parent=None)

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)

Return:
  requested index (QModelIndex)

#### HistoryTreeModel.mapFromSource

mapFromSource(sourceIndex)

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

sourceIndex
  reference to a source model index (QModelIndex)

Return:
  proxy model index (QModelIndex)

#### HistoryTreeModel.mapToSource

mapToSource(proxyIndex)

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

proxyIndex
  reference to a proxy model index (QModelIndex)

Return:
  source model index (QModelIndex)

#### HistoryTreeModel.parent

parent(index)

Public method to get the parent index.

index
  index of item to get parent (QModelIndex)

Return:
  index of parent (QModelIndex)

#### HistoryTreeModel.removeRows

removeRows(row, count, parent=None)

Public method to remove entries from the model.

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

Return:
  flag indicating successful removal (boolean)

#### HistoryTreeModel.rowCount

rowCount(parent=None)

Public method to determine the number of rows.

parent
  index of parent (QModelIndex)

Return:
  number of rows (integer)

#### HistoryTreeModel.setSourceModel

setSourceModel(sourceModel)

Public method to set the source model.

sourceModel
  reference to the source model (QAbstractItemModel)

Up