Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
SupportedProtocolsModel Class Reference

Tree model that exposes all registered Wireshark protocols and their fields, organised as a parent–child hierarchy suitable for display in the Supported Protocols dialog. More...

#include <supported_protocols_model.h>

Inheritance diagram for SupportedProtocolsModel:

Public Types

enum  SupportedProtocolsColumn {
  colName = 0 , colFilter , colType , colDescription ,
  colLast
}
 Column indices for the supported-protocols tree view. More...
 

Public Member Functions

 SupportedProtocolsModel (QObject *parent=Q_NULLPTR)
 Constructs an empty model; call populate() to load protocol data.
 
virtual ~SupportedProtocolsModel ()
 Destroys the model and all tree items.
 
int fieldCount ()
 Returns the total number of protocol fields loaded by populate().
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 Returns the model index for the item at row and column under parent.
 
QModelIndex parent (const QModelIndex &index) const
 Returns the parent index of the item at index.
 
QVariant data (const QModelIndex &index, int role) const
 Returns data for the given model index and role.
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Returns column header labels for the supported-protocols table.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Returns the number of child rows under parent.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 Returns the number of columns in the model.
 
void populate ()
 Populates the model by iterating all registered protocols and their fields; must be called before the model is used in a view.
 

Detailed Description

Tree model that exposes all registered Wireshark protocols and their fields, organised as a parent–child hierarchy suitable for display in the Supported Protocols dialog.

Member Enumeration Documentation

◆ SupportedProtocolsColumn

Column indices for the supported-protocols tree view.

Enumerator
colName 

Protocol or field name.

colFilter 

Filter expression string.

colType 

Field type as a human-readable string.

colDescription 

Description of the protocol or field.

colLast 

Sentinel value; total number of columns.

Constructor & Destructor Documentation

◆ SupportedProtocolsModel()

SupportedProtocolsModel::SupportedProtocolsModel ( QObject *  parent = Q_NULLPTR)
explicit

Constructs an empty model; call populate() to load protocol data.

Parameters
parentOptional parent QObject.

Member Function Documentation

◆ columnCount()

int SupportedProtocolsModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const

Returns the number of columns in the model.

Parameters
parentUnused.
Returns
Number of columns (colLast).

◆ data()

QVariant SupportedProtocolsModel::data ( const QModelIndex &  index,
int  role 
) const

Returns data for the given model index and role.

Parameters
indexModel index of the cell to query.
roleQt item data role.
Returns
The requested data, or an invalid QVariant if not applicable.

◆ fieldCount()

int SupportedProtocolsModel::fieldCount ( )
inline

Returns the total number of protocol fields loaded by populate().

Returns
Field count across all protocols.

◆ headerData()

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

Returns column header labels for the supported-protocols table.

Parameters
sectionColumn index.
orientationQt::Horizontal for column headers.
roleQt item data role.
Returns
Header label string, or an invalid QVariant if not applicable.

◆ index()

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

Returns the model index for the item at row and column under parent.

Parameters
rowRow within the parent item.
columnColumn index.
parentParent model index; invalid index for top-level items.
Returns
Model index for the requested item.

◆ parent()

QModelIndex SupportedProtocolsModel::parent ( const QModelIndex &  index) const

Returns the parent index of the item at index.

Parameters
indexChild model index.
Returns
Parent model index, or an invalid index for top-level items.

◆ rowCount()

int SupportedProtocolsModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

Returns the number of child rows under parent.

Parameters
parentParent model index; invalid index for the root.
Returns
Number of child items.

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