10#ifndef PROTO_TREE_MODEL_H
11#define PROTO_TREE_MODEL_H
16#include <QAbstractItemModel>
46 virtual Qt::ItemFlags
flags(
const QModelIndex &
index)
const;
54 QModelIndex
index(
int row,
int,
const QModelIndex &
parent = QModelIndex())
const;
61 virtual QModelIndex
parent(
const QModelIndex &
index)
const;
68 virtual int rowCount(
const QModelIndex &
parent = QModelIndex())
const;
74 virtual int columnCount(
const QModelIndex &)
const {
return 1; }
82 virtual QVariant data(
const QModelIndex &
index,
int role = Qt::DisplayRole)
const;
132 static bool foreachFindHfid(
ProtoNode *node,
void *find_hfid_ptr);
141 static bool foreachFindField(
ProtoNode *node,
void *find_finfo_ptr);
A wrapper class for the core proto_node structure, providing tree traversal and data access.
Definition proto_node.h:24
Item model that exposes a libwireshark proto_node tree to Qt views, enabling the packet-details tree ...
Definition proto_tree_model.h:25
void setRootNode(proto_node *root_node)
Sets the root node of the proto_node tree exposed by this model.
Definition proto_tree_model.cpp:183
QModelIndex findFirstHfid(int hf_id)
Searches the tree for the first node whose header-field ID matches hf_id.
Definition proto_tree_model.cpp:239
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
Definition proto_tree_model.cpp:38
~ProtoTreeModel()
Destroys the model. Does not free the underlying proto_node tree.
Definition proto_tree_model.cpp:33
virtual int columnCount(const QModelIndex &) const
Returns the number of columns (always 1).
Definition proto_tree_model.h:74
virtual QModelIndex parent(const QModelIndex &index) const
Returns the parent index of the item at index.
Definition proto_tree_model.cpp:68
QModelIndex index(int row, int, const QModelIndex &parent=QModelIndex()) const
Returns the model index for the child at row under parent.
Definition proto_tree_model.cpp:48
QModelIndex indexFromProtoNode(ProtoNode *index_node) const
Returns the model index corresponding to the given ProtoNode.
Definition proto_tree_model.cpp:202
ProtoNode * protoNodeFromIndex(const QModelIndex &index) const
Returns the ProtoNode wrapper for the item at the given model index.
Definition proto_tree_model.cpp:197
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of child rows under parent.
Definition proto_tree_model.cpp:77
QModelIndex findFieldInformation(FieldInformation *finfo)
Searches the tree for the node that corresponds to the given FieldInformation.
Definition proto_tree_model.cpp:274