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>
|
| | 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.
|
| |
|
|
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.
|
| |
List model that exposes all registered traffic-tap protocols with checkable rows, backed by a recent-protocol GList for persistence.
◆ 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.
|
◆ 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).
|
◆ 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. |
◆ columnCount()
| int TrafficTypesModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
overridevirtual |
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 |
|
overridevirtual |
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 |
|
overridevirtual |
Returns the item flags for the given index.
- Parameters
-
- Returns
- Flags including Qt::ItemIsUserCheckable for checkable rows.
◆ headerData()
| QVariant TrafficTypesModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
overridevirtual |
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 |
|
overridevirtual |
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 |
|
) |
| |
|
overridevirtual |
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: