DBC Framework
DBC parsing and CAN signal decoding framework
Loading...
Searching...
No Matches
DbcTreeModel Class Reference

#include <dbc_tree_model.h>

+ Inheritance diagram for DbcTreeModel:

Public Types

enum  Column {
  Name , CanId , PayloadLength , StartBit ,
  BitLength , ByteOrder , Signed , Unit ,
  Comment , ColumnCount
}
 Display columns for frame and signal metadata. More...
 
enum  Role {
  NodeTypeRole = Qt::UserRole + 1 , CanIdRole , PayloadLengthRole , StartBitRole ,
  BitLengthRole , LittleEndianRole , SignedRole , UnitRole ,
  CommentRole , ValueDescriptionsRole , ExtendedRole
}
 Typed metadata roles in addition to Qt display roles. More...
 

Public Member Functions

 DbcTreeModel (QObject *parent=nullptr)
 Create an empty read-only model.
 
void SetTree (std::unique_ptr< TreeNode > root)
 Replace the tree and invalidate indexes; reject roots with a parent or non-root type.
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 Return a child index; only column zero can have children.
 
QModelIndex parent (const QModelIndex &child) const override
 Return the parent in column zero, or an invalid index for frames.
 
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.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Return display text or typed metadata for an index.
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 Return horizontal display column titles.
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Allow selecting and enabling valid indexes without editing.
 

Detailed Description

Read-only model. Owns an immutable tree; all indexes expire on SetTree(). Use QPersistentModelIndex to observe reset invalidation. Call on the model thread.

Definition at line 11 of file dbc_tree_model.h.

Member Enumeration Documentation

◆ Column

Display columns for frame and signal metadata.

Definition at line 14 of file dbc_tree_model.h.

◆ Role

Typed metadata roles in addition to Qt display roles.

Definition at line 26 of file dbc_tree_model.h.

Constructor & Destructor Documentation

◆ DbcTreeModel()

DbcTreeModel::DbcTreeModel ( QObject *  parent = nullptr)
explicit

Create an empty read-only model.

Definition at line 25 of file dbc_tree_model.cpp.

Member Function Documentation

◆ SetTree()

void DbcTreeModel::SetTree ( std::unique_ptr< TreeNode >  root)

Replace the tree and invalidate indexes; reject roots with a parent or non-root type.

Definition at line 27 of file dbc_tree_model.cpp.

◆ index()

QModelIndex DbcTreeModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

Return a child index; only column zero can have children.

Definition at line 42 of file dbc_tree_model.cpp.

References TreeNode::GetChild().

◆ parent()

QModelIndex DbcTreeModel::parent ( const QModelIndex &  child) const
override

Return the parent in column zero, or an invalid index for frames.

Definition at line 53 of file dbc_tree_model.cpp.

References TreeNode::GetParent(), and TreeNode::GetRow().

◆ rowCount()

int DbcTreeModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Return the child count, capped at the Qt integer limit.

Definition at line 61 of file dbc_tree_model.cpp.

References TreeNode::GetChildCount().

◆ columnCount()

int DbcTreeModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Return the fixed metadata column count for this model.

Definition at line 70 of file dbc_tree_model.cpp.

◆ data()

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

◆ headerData()

QVariant DbcTreeModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

Return horizontal display column titles.

Definition at line 138 of file dbc_tree_model.cpp.

◆ flags()

Qt::ItemFlags DbcTreeModel::flags ( const QModelIndex &  index) const
override

Allow selecting and enabling valid indexes without editing.

Definition at line 145 of file dbc_tree_model.cpp.


The documentation for this class was generated from the following files: