4#include <QAbstractItemModel>
29 [[nodiscard]] QVariant
headerData(
int section, Qt::Orientation orientation,
int role)
const override;
44 [[nodiscard]] QVariant
data(
const QModelIndex&
index,
int role)
const override;
49 [[nodiscard]] Qt::ItemFlags
flags(
const QModelIndex&
index)
const override;
54 [[nodiscard]] QModelIndex
index(
int row,
int column,
const QModelIndex&
parent)
const override;
59 [[nodiscard]] QModelIndex
parent(
const QModelIndex& child)
const override;
129 bool _selected{
false};
138 QObject* _object{
nullptr};
142 TreeItem* _parentItem{
nullptr};
146 QList<TreeItem*> _childItems;
155 void addChild(QObject* obj, TreeItem*
parent);
168 QList<TreeItem*> _items;
172 QList<TreeItem*> _selected;
175 QIcon _iconContainer;
Item model for viewing Variables in a tree view.
Definition ObjectHierarchyModel.h:14
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Overridden from base class to provide column display names.
~ObjectHierarchyModel() override
Overridden destructor.
ObjectHierarchyModel(bool multi, QObject *parent)
Constructor.
QVariant data(const QModelIndex &index, int role) const override
Overridden from base class to provide the data to present.
int rowCount(const QModelIndex &parent) const override
Overridden from base class to provide the amount of rows.
QModelIndex index(int row, int column, const QModelIndex &parent) const override
Overridden from base class.
Qt::ItemFlags flags(const QModelIndex &index) const override
Overridden from base class to provide flags on an item by index.
void removeItem(const QModelIndex &index)
removes item at passed index.
bool isRoot(QModelIndex index) const
Determines if this is the root item.
void updateList(QObject *root)
Updates the list data using the passed object as root.
void toggleSelection(const QModelIndex &index)
Toggle the selection of the item at the passed index.
bool insertItemAt(const QModelIndex &parent, QObject *obj)
Inserts an object at the index.
int columnCount(const QModelIndex &parent) const override
Overridden from base class to provide the amount of columns.
QObject * getObject(QModelIndex index) const
Gets the current item from the tree.
QModelIndex getObjectIndex(QObject *obj)
Gets the model-index from the passed object.
QModelIndex parent(const QModelIndex &child) const override
Overridden from base class.
Definition Application.h:10