BaseTreeModel Class | Extending Qt Creator Manual

Extending Qt Creator Manual | BaseTreeModel

Extending Qt Creator Manual 4.6.0

# BaseTreeModel Class

(Utils::BaseTreeModel)

Inherited By: | Utils::TreeModel

- List of all members, including inherited members

## Signals

void | requestExpansion(QModelIndex)

## Protected Functions

| BaseTreeModel(QObject *parent = 0)
| BaseTreeModel(TreeItem *root, QObject *parent = 0)
| ~BaseTreeModel() override
bool | canFetchMore(const QModelIndex &idx) const override
void | clear()
int | columnCount(const QModelIndex &idx) const override
QVariant | data(const QModelIndex &idx, int role) const override
void | destroyItem(TreeItem *item)
void | fetchMore(const QModelIndex &idx) override
Qt::ItemFlags | flags(const QModelIndex &idx) const override
bool | hasChildren(const QModelIndex &idx) const override
QVariant | headerData(int section, Qt::Orientation orientation, int role) const override
QModelIndex | index(int, int, const QModelIndex &idx = QModelIndex()) const override
QModelIndex | indexForItem(const TreeItem *needle) const
TreeItem * | itemForIndex(const QModelIndex &) const
QModelIndex | parent(const QModelIndex &idx) const override
TreeItem * | rootItem() const
int | rowCount(const QModelIndex &idx = QModelIndex()) const override
bool | setData(const QModelIndex &idx, const QVariant &data, int role) override
void | setHeader(const QStringList &displays)
void | setHeaderToolTip(const QStringList &tips)
void | setRootItem(TreeItem *item)
QModelIndex | sibling(int row, int column, const QModelIndex &idx) const override
TreeItem * | takeItem(TreeItem *item)

## Member Function Documentation

### `[protected]` BaseTreeModel::BaseTreeModel(QObject *parent = 0)

Default constructs an instance of BaseTreeModel.

### `[protected]` BaseTreeModel::BaseTreeModel(TreeItem *root, QObject *parent = 0)

Default constructs an instance of BaseTreeModel.

### `[protected]` BaseTreeModel::~BaseTreeModel()

Destroys the instance of BaseTreeModel.

### `[protected]` bool BaseTreeModel::canFetchMore(const QModelIndex &idx) const

### `[protected]` void BaseTreeModel::clear()

Destroys all items in them model except the invisible root item.

### `[protected]` int BaseTreeModel::columnCount(const QModelIndex &idx) const

### `[protected]` QVariant BaseTreeModel::data(const QModelIndex &idx, int role) const

See also setData().

### `[protected]` void BaseTreeModel::destroyItem(TreeItem *item)

### `[protected]` void BaseTreeModel::fetchMore(const QModelIndex &idx)

### `[protected]` Qt::ItemFlags BaseTreeModel::flags(const QModelIndex &idx) const

### `[protected]` bool BaseTreeModel::hasChildren(const QModelIndex &idx) const

### `[protected]` QVariant BaseTreeModel::headerData(int section, Qt::Orientation orientation, int role) const

### `[protected]` QModelIndex BaseTreeModel::index(int, int, const QModelIndex &idx = QModelIndex()) const

### `[protected]` QModelIndex BaseTreeModel::indexForItem(const TreeItem *needle) const

### `[protected]` TreeItem *BaseTreeModel::itemForIndex(const QModelIndex &) const

### `[protected]` QModelIndex BaseTreeModel::parent(const QModelIndex &idx) const

### `[signal]` void BaseTreeModel::requestExpansion(QModelIndex)

### `[protected]` TreeItem *BaseTreeModel::rootItem() const

See also setRootItem().

### `[protected]` int BaseTreeModel::rowCount(const QModelIndex &idx = QModelIndex()) const

### `[protected]` bool BaseTreeModel::setData(const QModelIndex &idx, const QVariant &data, int role)

See also data().

### `[protected]` void BaseTreeModel::setHeader(const QStringList &displays)

### `[protected]` void BaseTreeModel::setHeaderToolTip(const QStringList &tips)

### `[protected]` void BaseTreeModel::setRootItem(TreeItem *item)

See also rootItem().

### `[protected]` QModelIndex BaseTreeModel::sibling(int row, int column, const QModelIndex &idx) const

### `[protected]` TreeItem *BaseTreeModel::takeItem(TreeItem *item)

Removes the specified item from the model.

Note: The item is not destroyed, ownership is effectively passed to the caller.