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

Sort/filter proxy model for TrafficTypesModel that supports case-insensitive name filtering and protocol-name–aware sorting. More...

#include <traffic_types_list.h>

Inheritance diagram for TrafficListSortModel:

Public Member Functions

 TrafficListSortModel (QObject *parent=nullptr)
 Constructs the sort/filter proxy model.
 
void setFilter (QString filter=QString())
 Sets the text filter used to show only protocols whose name contains the given string (case-insensitive). Pass an empty string to show all.
 

Protected Member Functions

virtual bool lessThan (const QModelIndex &source_left, const QModelIndex &source_right) const override
 Compares two rows for sorting, using protocol name for the name column and numeric ordering for the protocol-ID column.
 
virtual bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override
 Determines whether a source row should be visible given the current filter.
 

Detailed Description

Sort/filter proxy model for TrafficTypesModel that supports case-insensitive name filtering and protocol-name–aware sorting.

Constructor & Destructor Documentation

◆ TrafficListSortModel()

TrafficListSortModel::TrafficListSortModel ( QObject *  parent = nullptr)

Constructs the sort/filter proxy model.

Parameters
parentOptional parent QObject.

Member Function Documentation

◆ filterAcceptsRow()

bool TrafficListSortModel::filterAcceptsRow ( int  source_row,
const QModelIndex &  source_parent 
) const
overrideprotectedvirtual

Determines whether a source row should be visible given the current filter.

Parameters
source_rowRow index in the source model.
source_parentParent index in the source model (unused for list models).
Returns
true if the row's protocol name contains the filter string.

◆ lessThan()

bool TrafficListSortModel::lessThan ( const QModelIndex &  source_left,
const QModelIndex &  source_right 
) const
overrideprotectedvirtual

Compares two rows for sorting, using protocol name for the name column and numeric ordering for the protocol-ID column.

Parameters
source_leftIndex of the left-hand row in the source model.
source_rightIndex of the right-hand row in the source model.
Returns
true if source_left should sort before source_right.

◆ setFilter()

void TrafficListSortModel::setFilter ( QString  filter = QString())

Sets the text filter used to show only protocols whose name contains the given string (case-insensitive). Pass an empty string to show all.

Parameters
filterFilter string; empty clears the filter.

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