2#ifndef DBC_TREE_MODEL_H
3#define DBC_TREE_MODEL_H
6#include <QAbstractItemModel>
26 enum Role { NodeTypeRole = Qt::UserRole + 1,
35 ValueDescriptionsRole,
41 void SetTree(std::unique_ptr<TreeNode> root);
43 QModelIndex
index(
int row,
int column,
const QModelIndex &
parent = QModelIndex())
const override;
45 QModelIndex
parent(
const QModelIndex &child)
const override;
47 int rowCount(
const QModelIndex &
parent = QModelIndex())
const override;
51 QVariant
data(
const QModelIndex &
index,
int role = Qt::DisplayRole)
const override;
53 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
55 Qt::ItemFlags
flags(
const QModelIndex &
index)
const override;
59 std::unique_ptr<TreeNode> m_root;
Role
Typed metadata roles in addition to Qt display roles.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Return the child count, capped at the Qt integer limit.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Return the fixed metadata column count for this model.
Column
Display columns for frame and signal metadata.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Return a child index; only column zero can have children.
void SetTree(std::unique_ptr< TreeNode > root)
Replace the tree and invalidate indexes; reject roots with a parent or non-root type.
Qt::ItemFlags flags(const QModelIndex &index) const override
Allow selecting and enabling valid indexes without editing.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Return horizontal display column titles.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Return display text or typed metadata for an index.
QModelIndex parent(const QModelIndex &child) const override
Return the parent in column zero, or an invalid index for frames.
Tree node for later use in model/view or other hierarchy consumers.
ByteOrder
Signal byte order used for runtime decoding.
Qt-independent metadata tree nodes.