| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
FilterListModel Class Reference

A list model for managing capture filters, display filters, and display macros. More...

`#include <filter_list_model.h>`

Inheritance diagram for FilterListModel:

## Classes
struct | FilterListValue
| Represents a single filter entry with a name and an expression. More...

## Public Types
enum | FilterListType { Display , Capture , DisplayMacro }
| Defines the type of filter list. More...
enum | { ColumnName , ColumnExpression }
| Enumerates the columns for the filter list model. More...

## Public Member Functions
| FilterListModel (FilterListType type=FilterListModel::Display, QObject *parent=Q_NULLPTR)
| Constructs a new FilterListModel with a specific type.
| FilterListModel (QObject *parent=Q_NULLPTR)
| Constructs a new FilterListModel.
void | setFilterType (FilterListModel::FilterListType type)
| Sets the filter type for this model.
FilterListModel::FilterListType | filterType () const
| Retrieves the current filter type of the model.
QModelIndex | findByName (QString name)
| Finds a filter by its name.
QModelIndex | findByExpression (QString expression)
| Finds a filter by its expression.
QModelIndex | addFilter (QString name, QString expression)
| Adds a new filter to the list.
void | removeFilter (QModelIndex idx)
| Removes a filter at the specified index.
void | saveList ()
| Saves the current list of filters to persistent storage.
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const override
| Returns the number of rows under a given parent.
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const override
| Returns the number of columns under a given parent.
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override
| Retrieves data from the model for a given index and role.
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role) override
| Sets data in the model for a given index and role.
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
| Retrieves the header data for a specific section and role.
virtual Qt::ItemFlags | flags (const QModelIndex &index) const override
| Retrieves the item flags for a given index.
virtual Qt::DropActions | supportedDropActions () const override
| Retrieves the drop actions supported by the model.
virtual QStringList | mimeTypes () const override
| Retrieves the MIME types supported by the model for drag and drop operations.
virtual QMimeData * | mimeData (const QModelIndexList &indexes) const override
| Creates MIME data representing the given model indices.
virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
| Handles dropped MIME data to insert items into the model.

## Detailed Description

A list model for managing capture filters, display filters, and display macros.

## Member Enumeration Documentation

## ◆ anonymous enum

anonymous enum

Enumerates the columns for the filter list model.

Enumerator
ColumnName | The filter name column.
ColumnExpression | The filter expression column.

## ◆ FilterListType

enum FilterListModel::FilterListType

Defines the type of filter list.

Enumerator
Display | A list of display filters.
Capture | A list of capture filters.
DisplayMacro | A list of display macros.

## Constructor & Destructor Documentation

## ◆ FilterListModel() [1/2]

FilterListModel::FilterListModel | ( | FilterListModel::FilterListType | type = FilterListModel::Display,
|  | QObject * | parent = Q_NULLPTR )
| explicit

Constructs a new FilterListModel with a specific type.

Parameters

  type | The type of filter list (defaults to FilterListModel::Display).
  parent | The parent QObject, defaults to Q_NULLPTR.

## ◆ FilterListModel() [2/2]

FilterListModel::FilterListModel | ( | QObject * | parent = Q_NULLPTR | ) |
| explicit

Constructs a new FilterListModel.

Parameters

  parent | The parent QObject, defaults to Q_NULLPTR.

## Member Function Documentation

## ◆ addFilter()

QModelIndex FilterListModel::addFilter | ( | QString | name,
|  | QString | expression )

Adds a new filter to the list.

Parameters

  name | The name of the new filter.
  expression | The expression string of the new filter.

Returns
  The model index of the newly added filter.

## ◆ columnCount()

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

Returns the number of columns under a given parent.

Parameters

  parent | The parent model index (defaults to an invalid QModelIndex).

Returns
  The number of columns.

## ◆ data()

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

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

Parameters

  index | The model index.
  role | The data role requested (defaults to Qt::DisplayRole).

Returns
  The data associated with the index and role.

## ◆ dropMimeData()

bool FilterListModel::dropMimeData | ( | const QMimeData * | data,
|  | Qt::DropAction | action,
|  | int | row,
|  | int | column,
|  | const QModelIndex & | parent )
| override virtual

Handles dropped MIME data to insert items into the model.

Parameters

  data | The MIME data dropped.
  action | The drop action performed.
  row | The row where the drop occurred.
  column | The column where the drop occurred.
  parent | The parent model index.

Returns
  True if the drop was successfully handled, false otherwise.

## ◆ filterType()

FilterListModel::FilterListType FilterListModel::filterType | ( |  | ) | const

Retrieves the current filter type of the model.

Returns
  The filter list type.

## ◆ findByExpression()

QModelIndex FilterListModel::findByExpression | ( | QString | expression | ) |

Finds a filter by its expression.

Parameters

  expression | The expression to search for.

Returns
  The model index of the found filter, or an invalid index if not found.

## ◆ findByName()

QModelIndex FilterListModel::findByName | ( | QString | name | ) |

Finds a filter by its name.

Parameters

  name | The name to search for.

Returns
  The model index of the found filter, or an invalid index if not found.

## ◆ flags()

Qt::ItemFlags FilterListModel::flags | ( | const QModelIndex & | index | ) | const
| override virtual

Retrieves the item flags for a given index.

Parameters

  index | The model index.

Returns
  The item flags.

## ◆ headerData()

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

Retrieves the header data for a specific section and role.

Parameters

  section | The column or row section.
  orientation | The orientation of the header.
  role | The data role requested (defaults to Qt::DisplayRole).

Returns
  The header data.

## ◆ mimeData()

QMimeData * FilterListModel::mimeData | ( | const QModelIndexList & | indexes | ) | const
| override virtual

Creates MIME data representing the given model indices.

Parameters

  indexes | The list of model indices to encode.

Returns
  A pointer to the created QMimeData.

## ◆ mimeTypes()

QStringList FilterListModel::mimeTypes | ( |  | ) | const
| override virtual

Retrieves the MIME types supported by the model for drag and drop operations.

Returns
  A list of supported MIME types.

## ◆ removeFilter()

void FilterListModel::removeFilter | ( | QModelIndex | idx | ) |

Removes a filter at the specified index.

Parameters

  idx | The model index of the filter to remove.

## ◆ rowCount()

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

Returns the number of rows under a given parent.

Parameters

  parent | The parent model index (defaults to an invalid QModelIndex).

Returns
  The number of rows.

## ◆ setData()

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

Sets data in the model for a given index and role.

Parameters

  index | The model index to update.
  value | The value to set.
  role | The role being edited.

Returns
  True if successful, false otherwise.

## ◆ setFilterType()

void FilterListModel::setFilterType | ( | FilterListModel::FilterListType | type | ) |

Sets the filter type for this model.

Parameters

  type | The filter list type to set.

## ◆ supportedDropActions()

Qt::DropActions FilterListModel::supportedDropActions | ( |  | ) | const
| override virtual

Retrieves the drop actions supported by the model.

Returns
  The supported drop actions.

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

- /builds/wireshark/wireshark/ui/qt/models/filter_list_model.h
- /builds/wireshark/wireshark/ui/qt/models/filter_list_model.cpp