Item model that exposes a libwireshark proto_node tree to Qt views, enabling the packet-details tree to be driven by standard Qt model/view architecture.
More...
#include <proto_tree_model.h>
|
| | ProtoTreeModel (QObject *parent=0) |
| | Constructs an empty ProtoTreeModel with no root node.
|
| |
|
| ~ProtoTreeModel () |
| | Destroys the model. Does not free the underlying proto_node tree.
|
| |
| virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
| | Returns the item flags for the given index.
|
| |
| QModelIndex | index (int row, int, const QModelIndex &parent=QModelIndex()) const |
| | Returns the model index for the child at row under parent.
|
| |
| virtual QModelIndex | parent (const QModelIndex &index) const |
| | Returns the parent index of the item at index.
|
| |
| virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| | Returns the number of child rows under parent.
|
| |
| virtual int | columnCount (const QModelIndex &) const |
| | Returns the number of columns (always 1).
|
| |
| virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
| | Returns data for the given index and role.
|
| |
| void | setRootNode (proto_node *root_node) |
| | Sets the root node of the proto_node tree exposed by this model.
|
| |
| ProtoNode * | protoNodeFromIndex (const QModelIndex &index) const |
| | Returns the ProtoNode wrapper for the item at the given model index.
|
| |
| QModelIndex | indexFromProtoNode (ProtoNode *index_node) const |
| | Returns the model index corresponding to the given ProtoNode.
|
| |
| QModelIndex | findFirstHfid (int hf_id) |
| | Searches the tree for the first node whose header-field ID matches hf_id.
|
| |
| QModelIndex | findFieldInformation (FieldInformation *finfo) |
| | Searches the tree for the node that corresponds to the given FieldInformation.
|
| |
Item model that exposes a libwireshark proto_node tree to Qt views, enabling the packet-details tree to be driven by standard Qt model/view architecture.
◆ ProtoTreeModel()
| ProtoTreeModel::ProtoTreeModel |
( |
QObject * |
parent = 0 | ) |
|
|
explicit |
Constructs an empty ProtoTreeModel with no root node.
- Parameters
-
| parent | Optional parent QObject. |
◆ columnCount()
| virtual int ProtoTreeModel::columnCount |
( |
const QModelIndex & |
| ) |
const |
|
inlinevirtual |
Returns the number of columns (always 1).
- Returns
- 1.
◆ data()
| QVariant ProtoTreeModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
virtual |
Returns data for the given index and role.
- Parameters
-
| index | Model index of the requested item. |
| role | Qt item data role (e.g. Qt::DisplayRole). |
- Returns
- QVariant with the requested data, or an invalid QVariant if unavailable.
◆ findFieldInformation()
Searches the tree for the node that corresponds to the given FieldInformation.
- Parameters
-
- Returns
- Model index of the matching node, or an invalid index if not found.
◆ findFirstHfid()
| QModelIndex ProtoTreeModel::findFirstHfid |
( |
int |
hf_id | ) |
|
Searches the tree for the first node whose header-field ID matches hf_id.
- Parameters
-
- Returns
- Model index of the first matching node, or an invalid index if not found.
◆ flags()
| Qt::ItemFlags ProtoTreeModel::flags |
( |
const QModelIndex & |
index | ) |
const |
|
virtual |
Returns the item flags for the given index.
- Parameters
-
| index | Model index to query. |
- Returns
- Qt::ItemIsEnabled | Qt::ItemIsSelectable for valid indices; Qt::NoItemFlags otherwise.
◆ index()
| QModelIndex ProtoTreeModel::index |
( |
int |
row, |
|
|
int |
, |
|
|
const QModelIndex & |
parent = QModelIndex() |
|
) |
| const |
Returns the model index for the child at row under parent.
- Parameters
-
| row | Zero-based child row. |
| parent | Parent index; an invalid index refers to the root. |
- Returns
- Model index for the requested child, or an invalid index if out of range.
◆ indexFromProtoNode()
| QModelIndex ProtoTreeModel::indexFromProtoNode |
( |
ProtoNode * |
index_node | ) |
const |
Returns the model index corresponding to the given ProtoNode.
- Parameters
-
| index_node | ProtoNode to locate within the tree. |
- Returns
- Valid model index if found; an invalid index otherwise.
◆ parent()
| QModelIndex ProtoTreeModel::parent |
( |
const QModelIndex & |
index | ) |
const |
|
virtual |
Returns the parent index of the item at index.
- Parameters
-
| index | Model index whose parent is requested. |
- Returns
- Parent model index, or an invalid index if
index is a top-level item.
◆ protoNodeFromIndex()
| ProtoNode * ProtoTreeModel::protoNodeFromIndex |
( |
const QModelIndex & |
index | ) |
const |
Returns the ProtoNode wrapper for the item at the given model index.
- Parameters
-
| index | Model index to resolve. |
- Returns
- Pointer to the corresponding ProtoNode, or
nullptr for invalid indices.
◆ rowCount()
| int ProtoTreeModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
virtual |
Returns the number of child rows under parent.
- Parameters
-
| parent | Parent index; an invalid index refers to the root. |
- Returns
- Number of direct children, or 0 if
parent has no children.
◆ setRootNode()
| void ProtoTreeModel::setRootNode |
( |
proto_node * |
root_node | ) |
|
Sets the root node of the proto_node tree exposed by this model.
Resets the model and notifies all attached views. Passing nullptr clears the model.
- Parameters
-
| root_node | Pointer to the root proto_node, or nullptr to clear. |
The documentation for this class was generated from the following files:
- /builds/wireshark/wireshark/ui/qt/models/proto_tree_model.h
- /builds/wireshark/wireshark/ui/qt/models/proto_tree_model.cpp