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

A proxy model that provides custom sorting and filtering for the list of interfaces. More...

#include <interface_sort_filter_model.h>

Inheritance diagram for InterfaceSortFilterModel:

Public Member Functions

 InterfaceSortFilterModel (QObject *parent)
 Constructs a new InterfaceSortFilterModel.
 
void setStoreOnChange (bool storeOnChange)
 Configures whether changes to interface visibility state should be stored persistently.
 
void resetAllFilter ()
 Resets all current filters to their default states.
 
void setFilterHidden (bool filter)
 Sets whether hidden interfaces should be filtered out (not displayed).
 
bool filterHidden () const
 Checks if hidden interfaces are currently being filtered out.
 
int interfacesHidden ()
 Gets the count of interfaces that are currently hidden by the filter.
 
void toggleFilterHidden ()
 Toggles the filter state for hidden interfaces.
 
void setSortByActivity (bool sort)
 Sets whether the interfaces should be dynamically sorted based on network activity.
 
bool sortByActivity () const
 Checks if the interfaces are currently being sorted by activity.
 
void setInterfaceTypeVisible (int ifType, bool visible)
 Sets the visibility for a specific interface type.
 
bool isInterfaceTypeShown (int ifType) const
 Checks if a specific interface type is currently set to be visible.
 
void setFilterByType (bool filter, bool invert=false)
 Enables or disables filtering by interface type.
 
bool filterByType () const
 Checks if filtering by interface type is currently active.
 
void toggleTypeVisibility (int ifType)
 Toggles the visibility state for a specific interface type.
 
QList< int > typesDisplayed ()
 Retrieves a list of interface types that are currently set to be displayed.
 
void setColumns (QList< InterfaceTreeColumns > columns)
 Configures which specific columns from the source model should be displayed.
 
int mapSourceToColumn (InterfaceTreeColumns mdlIndex)
 Maps a logical column identifier to its actual display column index.
 
QModelIndex mapToSource (const QModelIndex &proxyIndex) const
 Maps a proxy model index to its corresponding source model index.
 
QModelIndex mapFromSource (const QModelIndex &sourceIndex) const
 Maps a source model index to its corresponding proxy model index.
 
QString interfaceError ()
 Retrieves any current interface-related error messages.
 

Protected Member Functions

bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const
 Determines whether a row from the source model matches all active filters.
 
bool filterAcceptsColumn (int source_column, const QModelIndex &source_parent) const
 Determines whether a column from the source model matches active column filters.
 
bool lessThan (const QModelIndex &source_left, const QModelIndex &source_right) const
 Compares two source indices to determine their sort order.
 

Detailed Description

A proxy model that provides custom sorting and filtering for the list of interfaces.

Constructor & Destructor Documentation

◆ InterfaceSortFilterModel()

InterfaceSortFilterModel::InterfaceSortFilterModel ( QObject *  parent)

Constructs a new InterfaceSortFilterModel.

Parameters
parentThe parent QObject.

Member Function Documentation

◆ filterAcceptsColumn()

bool InterfaceSortFilterModel::filterAcceptsColumn ( int  source_column,
const QModelIndex &  source_parent 
) const
protected

Determines whether a column from the source model matches active column filters.

Parameters
source_columnThe column index in the source model.
source_parentThe parent index in the source model.
Returns
True if the column should be displayed, false otherwise.

◆ filterAcceptsRow()

bool InterfaceSortFilterModel::filterAcceptsRow ( int  source_row,
const QModelIndex &  source_parent 
) const
protected

Determines whether a row from the source model matches all active filters.

Parameters
source_rowThe row index in the source model.
source_parentThe parent index in the source model.
Returns
True if the row should be displayed, false otherwise.

◆ filterByType()

bool InterfaceSortFilterModel::filterByType ( ) const

Checks if filtering by interface type is currently active.

Returns
True if type filtering is active, false otherwise.

◆ filterHidden()

bool InterfaceSortFilterModel::filterHidden ( ) const

Checks if hidden interfaces are currently being filtered out.

Returns
True if filtering hidden interfaces, false otherwise.

◆ interfaceError()

QString InterfaceSortFilterModel::interfaceError ( )

Retrieves any current interface-related error messages.

Returns
The error message string, or empty if no errors.

◆ interfacesHidden()

int InterfaceSortFilterModel::interfacesHidden ( )

Gets the count of interfaces that are currently hidden by the filter.

Returns
The number of hidden interfaces.

◆ isInterfaceTypeShown()

bool InterfaceSortFilterModel::isInterfaceTypeShown ( int  ifType) const

Checks if a specific interface type is currently set to be visible.

Parameters
ifTypeThe interface type identifier.
Returns
True if visible, false otherwise.

◆ lessThan()

bool InterfaceSortFilterModel::lessThan ( const QModelIndex &  source_left,
const QModelIndex &  source_right 
) const
protected

Compares two source indices to determine their sort order.

Parameters
source_leftThe first source index.
source_rightThe second source index.
Returns
True if the left item should appear before the right item.

◆ mapFromSource()

QModelIndex InterfaceSortFilterModel::mapFromSource ( const QModelIndex &  sourceIndex) const

Maps a source model index to its corresponding proxy model index.

Parameters
sourceIndexThe source model index.
Returns
The proxy model index.

◆ mapSourceToColumn()

int InterfaceSortFilterModel::mapSourceToColumn ( InterfaceTreeColumns  mdlIndex)

Maps a logical column identifier to its actual display column index.

Parameters
mdlIndexThe logical column identifier.
Returns
The display column index, or -1 if not found.

◆ mapToSource()

QModelIndex InterfaceSortFilterModel::mapToSource ( const QModelIndex &  proxyIndex) const

Maps a proxy model index to its corresponding source model index.

Parameters
proxyIndexThe proxy model index.
Returns
The source model index.

◆ setColumns()

void InterfaceSortFilterModel::setColumns ( QList< InterfaceTreeColumns columns)

Configures which specific columns from the source model should be displayed.

Parameters
columnsA list of InterfaceTreeColumns to show.

◆ setFilterByType()

void InterfaceSortFilterModel::setFilterByType ( bool  filter,
bool  invert = false 
)

Enables or disables filtering by interface type.

Parameters
filterTrue to apply type filtering, false to ignore type visibility settings.
invertTrue to invert the logic (show what is usually hidden, hide what is usually shown).

◆ setFilterHidden()

void InterfaceSortFilterModel::setFilterHidden ( bool  filter)

Sets whether hidden interfaces should be filtered out (not displayed).

Parameters
filterTrue to hide interfaces marked as hidden, false to show them.

◆ setInterfaceTypeVisible()

void InterfaceSortFilterModel::setInterfaceTypeVisible ( int  ifType,
bool  visible 
)

Sets the visibility for a specific interface type.

Parameters
ifTypeThe interface type identifier.
visibleTrue to make this type visible, false to hide it.

◆ setSortByActivity()

void InterfaceSortFilterModel::setSortByActivity ( bool  sort)

Sets whether the interfaces should be dynamically sorted based on network activity.

Parameters
sortTrue to sort by activity, false to use standard sorting.

◆ setStoreOnChange()

void InterfaceSortFilterModel::setStoreOnChange ( bool  storeOnChange)

Configures whether changes to interface visibility state should be stored persistently.

Parameters
storeOnChangeTrue to store changes automatically, false otherwise.

◆ sortByActivity()

bool InterfaceSortFilterModel::sortByActivity ( ) const

Checks if the interfaces are currently being sorted by activity.

Returns
True if sorting by activity, false otherwise.

◆ toggleTypeVisibility()

void InterfaceSortFilterModel::toggleTypeVisibility ( int  ifType)

Toggles the visibility state for a specific interface type.

Parameters
ifTypeThe interface type identifier.

◆ typesDisplayed()

QList< int > InterfaceSortFilterModel::typesDisplayed ( )

Retrieves a list of interface types that are currently set to be displayed.

Returns
A list of integer type identifiers.

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