# eric7.WebBrowser.Bookmarks.BookmarksModel

Module implementing the bookmark model class.

### Global Attributes

None

### Classes

BookmarksModel | Class implementing the bookmark model.

### Functions

None

## BookmarksModel

Class implementing the bookmark model.

### Derived from

QAbstractItemModel

### Class Attributes

MIMETYPE
SeparatorRole
TypeRole
UrlRole
UrlStringRole
VisitCountRole

### Class Methods

None

### Methods

BookmarksModel | Constructor
bookmarksManager | Public method to get a reference to the bookmarks manager.
columnCount | Public method to get the number of columns.
data | Public method to get data from the model.
dropMimeData | Public method to accept the mime data of a drop action.
entryAdded | Public slot to add a bookmark node.
entryChanged | Public method to change a node.
entryRemoved | Public slot to remove a bookmark node.
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.
mimeData | Public method to return the mime data.
mimeTypes | Public method to report the supported mime types.
node | Public method to get a bookmark node given its index.
nodeIndex | Public method to get a model index.
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.
setData | Public method to set the data of a node cell.
supportedDropActions | Public method to report the supported drop actions.

### Static Methods

None

#### BookmarksModel (Constructor)

BookmarksModel(manager, parent=None)

Constructor

manager
  reference to the bookmark manager object (BookmarksManager)
parent
  reference to the parent object (QObject)

#### BookmarksModel.bookmarksManager

bookmarksManager()

Public method to get a reference to the bookmarks manager.

Return:
  reference to the bookmarks manager object (BookmarksManager)

#### BookmarksModel.columnCount

columnCount(parent=None)

Public method to get the number of columns.

parent
  index of parent (QModelIndex)

Return:
  number of columns (integer)

#### BookmarksModel.data

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

Public method to get data from the model.

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

Return:
  bookmark data

#### BookmarksModel.dropMimeData

dropMimeData(data, action, row, column, parent)

Public method to accept the mime data of a drop action.

data
  reference to the mime data (QMimeData)
action
  drop action requested (Qt.DropAction)
row
  row number (integer)
column
  column number (integer)
parent
  index of the parent node (QModelIndex)

Return:
  flag indicating successful acceptance of the data (boolean)

#### BookmarksModel.entryAdded

entryAdded(node)

Public slot to add a bookmark node.

node
  reference to the bookmark node to add (BookmarkNode)

#### BookmarksModel.entryChanged

entryChanged(node)

Public method to change a node.

node
  reference to the bookmark node to change (BookmarkNode)

#### BookmarksModel.entryRemoved

entryRemoved(parent, row, node)

Public slot to remove a bookmark node.

parent
  reference to the parent bookmark node (BookmarkNode)
row
  row number of the node (integer)
node
  reference to the bookmark node to remove (BookmarkNode)

#### BookmarksModel.flags

flags(index)

Public method to get flags for a node cell.

index
  index of the node cell (QModelIndex)

Return:
  flags (Qt.ItemFlags)

#### BookmarksModel.hasChildren

hasChildren(parent=None)

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

parent
  index of the parent node (QModelIndex)

Return:
  flag indicating the presence of children (boolean)

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

#### BookmarksModel.index

index(row, column, parent=None)

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)

Return:
  index (QModelIndex)

#### BookmarksModel.mimeData

mimeData(indexes)

Public method to return the mime data.

indexes
  list of indexes (QModelIndexList)

Return:
  mime data (QMimeData)

#### BookmarksModel.mimeTypes

mimeTypes()

Public method to report the supported mime types.

Return:
  supported mime types (list of strings)

#### BookmarksModel.node

node(index)

Public method to get a bookmark node given its index.

index
  index of the node (QModelIndex)

Return:
  bookmark node (BookmarkNode)

#### BookmarksModel.nodeIndex

nodeIndex(node)

Public method to get a model index.

node
  reference to the node to get the index for (BookmarkNode)

Return:
  model index (QModelIndex)

#### BookmarksModel.parent

parent(index=None)

Public method to get the index of the parent node.

index
  index of the child node (QModelIndex)

Return:
  index of the parent node (QModelIndex)

#### BookmarksModel.removeRows

removeRows(row, count, parent=None)

Public method to remove bookmarks from the model.

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

Return:
  flag indicating successful removal (boolean)

#### BookmarksModel.rowCount

rowCount(parent=None)

Public method to determine the number of rows.

parent
  index of parent (QModelIndex)

Return:
  number of rows (integer)

#### BookmarksModel.setData

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

Public method to set the data of a node cell.

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

Return:
  flag indicating success (boolean)

#### BookmarksModel.supportedDropActions

supportedDropActions()

Public method to report the supported drop actions.

Return:
  supported drop actions (Qt.DropAction)

Up