Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | Static Public Attributes | List of all members
InterfaceTreeModel Class Reference

A table model representing the system's available capture interfaces. More...

#include <interface_tree_model.h>

Inheritance diagram for InterfaceTreeModel:

Public Slots

void interfaceListChanged ()
 Slot triggered when the global list of available interfaces changes.
 

Public Member Functions

 InterfaceTreeModel (QObject *parent)
 Constructs a new InterfaceTreeModel.
 
 ~InterfaceTreeModel ()
 Destroys the InterfaceTreeModel.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Returns the number of rows (interfaces) under a given parent.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 Returns the number of columns in the table model.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Retrieves data from the model for a given index and role.
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 Retrieves the header data for a specific section and role.
 
void updateStatistic (unsigned int row)
 Triggers an update of the statistics (like sparklines) for a specific row.
 
QString interfaceError ()
 Retrieves any current interface-related error messages.
 
QItemSelection selectedDevices ()
 Retrieves the currently selected devices as an item selection.
 
bool updateSelectedDevices (QItemSelection sourceSelection)
 Updates the internal state of selected devices based on a UI selection.
 
QVariant getColumnContent (int idx, int col, int role=Qt::DisplayRole)
 Gets the content for a specific column and row directly.
 

Static Public Attributes

static const QString DefaultNumericValue = QObject::tr("default")
 

Detailed Description

A table model representing the system's available capture interfaces.

Constructor & Destructor Documentation

◆ InterfaceTreeModel()

InterfaceTreeModel::InterfaceTreeModel ( QObject *  parent)

Constructs a new InterfaceTreeModel.

Parameters
parentThe parent QObject.

This is the data model for interface trees. It implies, that the index within global_capture_opts.all_ifaces is identical to the row. This is always the case, even when interfaces are hidden by the proxy model. But for this to work, every access to the index from within the view, has to be filtered through the proxy model.

Member Function Documentation

◆ columnCount()

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

Returns the number of columns in the table model.

Parameters
parentThe parent model index (defaults to an invalid QModelIndex).
Returns
The number of columns.

◆ data()

QVariant InterfaceTreeModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const

Retrieves data from the model for a given index and role.

Parameters
indexThe model index.
roleThe data role requested (defaults to Qt::DisplayRole).
Returns
The data associated with the index and role.

◆ getColumnContent()

QVariant InterfaceTreeModel::getColumnContent ( int  idx,
int  col,
int  role = Qt::DisplayRole 
)

Gets the content for a specific column and row directly.

Parameters
idxThe row index.
colThe column index.
roleThe data role (defaults to Qt::DisplayRole).
Returns
The requested data variant.

◆ headerData()

QVariant InterfaceTreeModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Retrieves the header data for a specific section and role.

Parameters
sectionThe column or row section.
orientationThe orientation of the header.
roleThe data role requested.
Returns
The header data.

◆ interfaceError()

QString InterfaceTreeModel::interfaceError ( )

Retrieves any current interface-related error messages.

Returns
The error message string.

◆ interfaceListChanged

void InterfaceTreeModel::interfaceListChanged ( )
slot

Slot triggered when the global list of available interfaces changes.

The interface list has changed. global_capture_opts.all_ifaces may have been reloaded or changed with current data. beginResetModel() and endResetModel() will signalize the proxy model and the view, that the data has changed and the view has to reload

◆ rowCount()

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

Returns the number of rows (interfaces) under a given parent.

Parameters
parentThe parent model index (defaults to an invalid QModelIndex).
Returns
The number of rows.

◆ selectedDevices()

QItemSelection InterfaceTreeModel::selectedDevices ( )

Retrieves the currently selected devices as an item selection.

Returns
A QItemSelection representing the selected interfaces.

◆ updateSelectedDevices()

bool InterfaceTreeModel::updateSelectedDevices ( QItemSelection  sourceSelection)

Updates the internal state of selected devices based on a UI selection.

Parameters
sourceSelectionThe selection from the view.
Returns
True if the selection state changed successfully, false otherwise.

◆ updateStatistic()

void InterfaceTreeModel::updateStatistic ( unsigned int  row)

Triggers an update of the statistics (like sparklines) for a specific row.

Parameters
rowThe row index of the interface to update.

Member Data Documentation

◆ DefaultNumericValue

const QString InterfaceTreeModel::DefaultNumericValue = QObject::tr("default")
static

A default placeholder string for unavailable numeric values.


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