CodexTreeModel.h header

#include <ew/app/CodexTreeModel.h>

Namespace ew::app

CodexTreeModel class

class ew::app::CodexTreeModel

A tree model of the whole codex: each category is a node, with its sub-categories and then its entities nested beneath it, so categories and their members read as one navigable tree instead of a separate list. Uncategorized entities appear at the top level. Read-only over the project; call refresh() after the taxonomy or entities change.

Members

ew::app::CodexTreeModel::CodexTreeModel(QObject *parent=nullptr)

Constructs an empty codex tree model with parent parent.

ew::app::CodexTreeModel::~CodexTreeModel() override

Destroys the model.

ew::app::CodexTreeModel::CodexTreeModel(const CodexTreeModel &)=delete

Not copyable.

ew::app::CodexTreeModel::CodexTreeModel(CodexTreeModel &&)=delete

Not movable.

CodexTreeModel & ew::app::CodexTreeModel::operator=(const CodexTreeModel &)=delete

Not copyable.

CodexTreeModel & ew::app::CodexTreeModel::operator=(CodexTreeModel &&)=delete

Not movable.

void ew::app::CodexTreeModel::setProject(const ew::core::Project *project)

Points the model at project (not owned; may be null) and rebuilds it.

void ew::app::CodexTreeModel::refresh()

Re-reads the taxonomy and entities and rebuilds the tree.

void ew::app::CodexTreeModel::setActiveAudience(QString audience)

Sets the audience to view the codex as, and rebuilds. When non-empty, entities not visible to audience (see ContentObject::isVisibleTo) are hidden – a "view as this reader" lens. An empty audience is the author's view: everything shows.

QModelIndex ew::app::CodexTreeModel::indexForCategory(ew::core::CategoryId id) const

The index of the category id anywhere in the tree, or an invalid index.

QModelIndex ew::app::CodexTreeModel::indexForEntity(ew::core::ContentId id) const

The index of the entity id anywhere in the tree, or an invalid index.

QModelIndex ew::app::CodexTreeModel::index(int row, int column, const QModelIndex &parent=QModelIndex()) const override

Returns the index of the child at row, column under parent (QAbstractItemModel).

QModelIndex ew::app::CodexTreeModel::parent(const QModelIndex &child) const override

Returns the parent index of child (QAbstractItemModel).

int ew::app::CodexTreeModel::rowCount(const QModelIndex &parent=QModelIndex()) const override

Returns the number of child rows under parent (QAbstractItemModel).

int ew::app::CodexTreeModel::columnCount(const QModelIndex &parent=QModelIndex()) const override

Returns the column count under parent (QAbstractItemModel).

QVariant ew::app::CodexTreeModel::data(const QModelIndex &index, int role=Qt::DisplayRole) const override

Returns the codex tree's data for index and role (QAbstractItemModel).

static ew::core::CategoryId ew::app::CodexTreeModel::categoryIdAt(const QModelIndex &index)

The category id at index if it is a category node, else a null id.

static ew::core::ContentId ew::app::CodexTreeModel::entityIdAt(const QModelIndex &index)

The entity id at index if it is an entity node, else a null id.