12#ifndef TREE_MODEL_HELPERS_H
13#define TREE_MODEL_HELPERS_H
18#include <QAbstractItemModel>
23template <
typename Item>
Base class to inherit basic tree item from.
Definition tree_model_helpers.h:25
void prependChild(Item *child)
Prepends a child item to the beginning of the children list.
Definition tree_model_helpers.h:62
void appendChild(Item *child)
Appends a child item to the end of the children list.
Definition tree_model_helpers.h:53
Item * parent_
Definition tree_model_helpers.h:128
void removeChild(int row)
Removes and deletes the child item at the specified row.
Definition tree_model_helpers.h:81
virtual ~ModelHelperTreeItem()
Destroys the ModelHelperTreeItem and its children.
Definition tree_model_helpers.h:39
void insertChild(int row, Item *child)
Inserts a child item at the specified row.
Definition tree_model_helpers.h:72
ModelHelperTreeItem(Item *parent)
Constructs a new ModelHelperTreeItem.
Definition tree_model_helpers.h:31
Item * parentItem()
Retrieves the parent item.
Definition tree_model_helpers.h:124
int childCount() const
Gets the total number of child items.
Definition tree_model_helpers.h:101
QList< QVariant > childItems_
Definition tree_model_helpers.h:131
Item * child(int row)
Retrieves the child item at the specified row.
Definition tree_model_helpers.h:92
int row()
Gets the row index of this item relative to its parent.
Definition tree_model_helpers.h:110
A template utility class for converting between pointers and QVariant objects.
Definition variant_pointer.h:23
static T * asPtr(QVariant v)
Converts a QVariant containing a void pointer back to a typed pointer.
Definition variant_pointer.h:31