# eric6.Helpviewer.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)

Returns:
  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=QModelIndex())

Public method to get the number of columns.

parent
  index of parent (QModelIndex)

Returns:
  number of columns (integer)

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

#### HistoryTreeModel.flags

flags(index)

Public method to get the item flags.

index
  index of the item (QModelIndex)

Returns:
  flags (Qt.ItemFlags)

#### HistoryTreeModel.hasChildren

hasChildren(parent=QModelIndex())

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

parent
  index of the entry to check (QModelIndex)

Returns:
  flag indicating the presence of children (boolean)

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

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

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

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

#### HistoryTreeModel.parent

parent(index)

Public method to get the parent index.

index
  index of item to get parent (QModelIndex)

Returns:
  index of parent (QModelIndex)

#### HistoryTreeModel.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)
parent
  index of the parent entry (QModelIndex)

Returns:
  flag indicating successful removal (boolean)

#### HistoryTreeModel.rowCount

rowCount(parent=QModelIndex())

Public method to determine the number of rows.

parent
  index of parent (QModelIndex)

Returns:
  number of rows (integer)

#### HistoryTreeModel.setSourceModel

setSourceModel(sourceModel)

Public method to set the source model.

sourceModel
  reference to the source model (QAbstractItemModel)

Up