| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Public Types | Public Slots | Signals | Public Member Functions | Public Attributes | List of all members
TrafficTypesModel Class Reference

List model that exposes all registered traffic-tap protocols with checkable rows, backed by a recent-protocol GList for persistence. More...

`#include <traffic_types_list.h>`

Inheritance diagram for TrafficTypesModel:

## Public Types
enum | { TRAFFIC_PROTOCOL = Qt::UserRole , TRAFFIC_IS_CHECKED }
| Custom Qt::UserRole values for retrieving protocol data from the model. More...
enum | { COL_CHECKED , COL_NAME , COL_NUM , COL_PROTOCOL }
| Column indices for the traffic-types table view. More...

## Public Slots
void | selectProtocols (QList< int > protocols)
| Replaces the current selection with the given protocol IDs and emits protocolsChanged().

## Signals
void | protocolsChanged (QList< int > protocols)
| Emitted whenever the set of checked protocols changes.

## Public Member Functions
| TrafficTypesModel (GList **recentList, QObject *parent=nullptr)
| Constructs the model from the full set of registered tap protocols.
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const override
| Returns the number of protocol rows in the model.
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const override
| Returns the number of columns in the model.
virtual QVariant | data (const QModelIndex &idx, int role=Qt::DisplayRole) const override
| Returns data for the given index and role.
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
| Returns header labels for the traffic-types columns.
virtual bool | setData (const QModelIndex &idx, const QVariant &value, int role) override
| Sets data for the given index and role, updating the checked state and emitting protocolsChanged() when the selection changes.
virtual Qt::ItemFlags | flags (const QModelIndex &idx) const override
| Returns the item flags for the given index.
QList< int > | protocols () const
| Returns the list of currently checked (selected) protocol IDs.

## Public Attributes
enum TrafficTypesModel:: { ... } | eTrafficUserData
| Custom Qt::UserRole values for retrieving protocol data from the model.
enum TrafficTypesModel:: { ... } | eTrafficColumnNames
| Column indices for the traffic-types table view.

## Detailed Description

List model that exposes all registered traffic-tap protocols with checkable rows, backed by a recent-protocol GList for persistence.

## Member Enumeration Documentation

## ◆ anonymous enum

anonymous enum

Column indices for the traffic-types table view.

Enumerator
COL_CHECKED | Checkbox column indicating whether the protocol is selected.
COL_NAME | Protocol display name column.
COL_NUM | Total number of data columns.
COL_PROTOCOL | Numeric protocol ID column (hidden/internal).

## ◆ anonymous enum

anonymous enum

Custom Qt::UserRole values for retrieving protocol data from the model.

Enumerator
TRAFFIC_PROTOCOL | Returns the numeric protocol ID.
TRAFFIC_IS_CHECKED | Returns the checked state as a bool.

## Constructor & Destructor Documentation

## ◆ TrafficTypesModel()

TrafficTypesModel::TrafficTypesModel | ( | GList ** | recentList,
|  | QObject * | parent = nullptr )

Constructs the model from the full set of registered tap protocols.

Parameters

  recentList | Pointer to the recent-protocols GList used to initialise checked states and updated when selections change.
  parent | Optional parent QObject.

## Member Function Documentation

## ◆ columnCount()

int TrafficTypesModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const
| override virtual

Returns the number of columns in the model.

Parameters

  parent | Unused; must be an invalid index for list models.

Returns
  Number of columns (COL_NUM).

## ◆ data()

QVariant TrafficTypesModel::data | ( | const QModelIndex & | idx,
|  | int | role = Qt::DisplayRole ) const
| override virtual

Returns data for the given index and role.

Parameters

  idx | Model index of the cell to query.
  role | Qt item data role (Qt::DisplayRole, Qt::CheckStateRole, UserRole, etc.).

Returns
  The requested data, or an invalid QVariant if not applicable.

## ◆ flags()

Qt::ItemFlags TrafficTypesModel::flags | ( | const QModelIndex & | idx | ) | const
| override virtual

Returns the item flags for the given index.

Parameters

  idx | Model index to query.

Returns
  Flags including Qt::ItemIsUserCheckable for checkable rows.

## ◆ headerData()

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

Returns header labels for the traffic-types columns.

Parameters

  section | Column or row index.
  orientation | Qt::Horizontal for column headers; Qt::Vertical for row headers.
  role | Qt item data role.

Returns
  Header label string, or an invalid QVariant if not applicable.

## ◆ protocols()

QList< int > TrafficTypesModel::protocols | ( |  | ) | const

Returns the list of currently checked (selected) protocol IDs.

Returns
  List of selected protocol IDs.

## ◆ protocolsChanged

void TrafficTypesModel::protocolsChanged | ( | QList< int > | protocols | ) |
| signal

Emitted whenever the set of checked protocols changes.

Parameters

  protocols | Updated list of selected protocol IDs.

## ◆ rowCount()

int TrafficTypesModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const
| override virtual

Returns the number of protocol rows in the model.

Parameters

  parent | Unused; must be an invalid index for list models.

Returns
  Number of rows.

## ◆ selectProtocols

void TrafficTypesModel::selectProtocols | ( | QList< int > | protocols | ) |
| slot

Replaces the current selection with the given protocol IDs and emits protocolsChanged().

Parameters

  protocols | List of protocol IDs to select.

## ◆ setData()

bool TrafficTypesModel::setData | ( | const QModelIndex & | idx,
|  | const QVariant & | value,
|  | int | role )
| override virtual

Sets data for the given index and role, updating the checked state and emitting protocolsChanged() when the selection changes.

Parameters

  idx | Model index of the cell to modify.
  value | New value to apply.
  role | Qt item data role; only Qt::CheckStateRole is handled.

Returns
  `true` if the data was successfully set.

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

- /builds/wireshark/wireshark/ui/qt/widgets/traffic_types_list.h
- /builds/wireshark/wireshark/ui/qt/widgets/traffic_types_list.cpp