# eric4.Helpviewer.AdBlock.AdBlockModel

Module implementing a model for the AdBlock dialog.

### Global Attributes

None

### Classes

AdBlockModel | Class implementing a model for the AdBlock dialog.

### Functions

None

## AdBlockModel

Class implementing a model for the AdBlock dialog.

### Derived from

QAbstractItemModel

### Class Attributes

None

### Class Methods

None

### Methods

AdBlockModel | Constructor
__rulesChanged | Private slot to handle changes in rules.
columnCount | Public method to get the number of columns.
data | Public method to get data from the model.
flags | Public method to get flags for a node cell.
hasChildren | Public method to check, if a parent node has some children.
headerData | Public method to get the header data.
index | Public method to get a model index for a node cell.
parent | Public method to get the index of the parent node.
removeRows | Public method to remove bookmarks from the model.
rowCount | Public method to determine the number of rows.
rule | Public method to get the rule given its index.
setData | Public method to set the data of a node cell.
subscription | Public method to get the subscription given its index.
subscriptionIndex | Public method to get the index of a subscription.

### Static Methods

None

#### AdBlockModel (Constructor)

AdBlockModel(parent = None)

Constructor

parent
  reference to the parent object (QObject)

#### AdBlockModel.__rulesChanged

__rulesChanged()

Private slot to handle changes in rules.

#### AdBlockModel.columnCount

columnCount(parent = QModelIndex())

Public method to get the number of columns.

parent
  index of parent (QModelIndex)

Returns:
  number of columns (integer)

#### AdBlockModel.data

data(index, role = Qt.DisplayRole)

Public method to get data from the model.

index
  index of bookmark to get data for (QModelIndex)
role
  data role (integer)

Returns:
  bookmark data (QVariant)

#### AdBlockModel.flags

flags(index)

Public method to get flags for a node cell.

index
  index of the node cell (QModelIndex)

Returns:
  flags (Qt.ItemFlags)

#### AdBlockModel.hasChildren

hasChildren(parent = QModelIndex())

Public method to check, if a parent node has some children.

parent
  index of the parent node (QModelIndex)

Returns:
  flag indicating the presence of children (boolean)

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

#### AdBlockModel.index

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

Public method to get a model index for a node cell.

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

Returns:
  index (QModelIndex)

#### AdBlockModel.parent

parent(index = QModelIndex())

Public method to get the index of the parent node.

index
  index of the child node (QModelIndex)

Returns:
  index of the parent node (QModelIndex)

#### AdBlockModel.removeRows

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

Public method to remove bookmarks from the model.

row
  row of the first bookmark to remove (integer)
count
  number of bookmarks to remove (integer)
index
  of the parent bookmark node (QModelIndex)

Returns:
  flag indicating successful removal (boolean)

#### AdBlockModel.rowCount

rowCount(parent = QModelIndex())

Public method to determine the number of rows.

parent
  index of parent (QModelIndex)

Returns:
  number of rows (integer)

#### AdBlockModel.rule

rule(index)

Public method to get the rule given its index.

index
  index of the rule (QModelIndex)

Returns:
  reference to the rule (AdBlockRule)

#### AdBlockModel.setData

setData(index, value, role = Qt.EditRole)

Public method to set the data of a node cell.

index
  index of the node cell (QModelIndex)
value
  value to be set (QVariant)
role
  role of the data (integer)

Returns:
  flag indicating success (boolean)

#### AdBlockModel.subscription

subscription(index)

Public method to get the subscription given its index.

index
  index of the subscription (QModelIndex)

Returns:
  reference to the subscription (AdBlockSubscription)

#### AdBlockModel.subscriptionIndex

subscriptionIndex(subscription)

Public method to get the index of a subscription.

subscription
  reference to the subscription (AdBlockSubscription)

Returns:
  index of the subscription (QModelIndex)

Up