# 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 (QAbstractItemModel)
  reference to the source model
parent (QObject)
  reference to the parent object

#### HistoryTreeModel.__sourceDateRow

__sourceDateRow(row)

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

row (int)
  row number of the date

Return:
  offset where that date starts

Return Type:
  int

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

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

#### HistoryTreeModel.columnCount

columnCount(parent=None)

Public method to get the number of columns.

parent (QModelIndex)
  index of parent

Return:
  number of columns

Return Type:
  int

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

#### HistoryTreeModel.flags

flags(index)

Public method to get the item flags.

index (QModelIndex)
  index of the item

Return:
  flags

Return Type:
  Qt.ItemFlags

#### HistoryTreeModel.hasChildren

hasChildren(parent=None)

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

parent (QModelIndex)
  index of the entry to check

Return:
  flag indicating the presence of children

Return Type:
  bool

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

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

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

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

#### HistoryTreeModel.parent

parent(index)

Public method to get the parent index.

index (QModelIndex)
  index of item to get parent

Return:
  index of parent

Return Type:
  QModelIndex

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

#### HistoryTreeModel.rowCount

rowCount(parent=None)

Public method to determine the number of rows.

parent (QModelIndex)
  index of parent

Return:
  number of rows

Return Type:
  int

#### HistoryTreeModel.setSourceModel

setSourceModel(sourceModel)

Public method to set the source model.

sourceModel (QAbstractItemModel)
  reference to the source model

Up