| Wireshark 4.7.3 The Wireshark network protocol analyzer

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

A model managing the coloring rules for packet display. More...

`#include <coloring_rules_model.h>`

Inheritance diagram for ColoringRulesModel:

## Public Types
enum | ColoringRulesColumn { colName = 0 , colFilter , colColoringRulesMax }
| Defines the columns used in the coloring rules model. More...

## Public Member Functions
| ColoringRulesModel (QColor defaultForeground, QColor defaultBackground, QObject *parent)
| Constructs a new ColoringRulesModel.
virtual | ~ColoringRulesModel ()
| Destroys the ColoringRulesModel.
void | addColor (color_filter_t *colorf)
| Adds a new color rule from a core color filter.
void | addColor (bool disabled, QString filter, QColor foreground, QColor background)
| Adds a new color rule with specified properties.
bool | importColors (QString filename, QString &err)
| Imports coloring rules from a specified file.
bool | exportColors (QString filename, QString &err)
| Exports the current coloring rules to a file.
bool | writeColors (QString &err)
| Writes the coloring rules to the internal configuration.
Qt::ItemFlags | flags (const QModelIndex &index) const override
| Retrieves the item flags for a given index.
QVariant | data (const QModelIndex &index, int role) const override
| Retrieves data from the model for the given index and role.
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
| Sets data in the model for the given index and role.
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
| Retrieves header data for the given section, orientation, and role.
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
| Generates an index for the specified row and column.
QModelIndex | parent (const QModelIndex &indexItem) const override
| Retrieves the parent index of the specified index.
Qt::DropActions | supportedDropActions () const override
| Specifies the supported drag and drop actions.
QStringList | mimeTypes () const override
| Retrieves the list of supported MIME types for drag and drop operations.
QMimeData * | mimeData (const QModelIndexList &indexes) const override
| Generates MIME data for the specified list of indexes.
bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
| Handles dropped MIME data.
int | rowCount (const QModelIndex &parent=QModelIndex()) const override
| Returns the number of rows under the given parent.
int | columnCount (const QModelIndex &parent=QModelIndex()) const override
| Returns the number of columns under the given parent.
bool | insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
| Inserts rows into the model.
bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
| Removes rows from the model.
bool | copyRow (int dst_row, int src_row)
| Copies a row from one index to another.

## Detailed Description

A model managing the coloring rules for packet display.

## Member Enumeration Documentation

## ◆ ColoringRulesColumn

enum ColoringRulesModel::ColoringRulesColumn

Defines the columns used in the coloring rules model.

Enumerator
colName | The name column.
colFilter | The filter string column.
colColoringRulesMax | The maximum number of columns.

## Constructor & Destructor Documentation

## ◆ ColoringRulesModel()

ColoringRulesModel::ColoringRulesModel | ( | QColor | defaultForeground,
|  | QColor | defaultBackground,
|  | QObject * | parent )

Constructs a new ColoringRulesModel.

Parameters

  defaultForeground | The default foreground color.
  defaultBackground | The default background color.
  parent | The parent QObject.

## Member Function Documentation

## ◆ addColor() [1/2]

void ColoringRulesModel::addColor | ( | bool | disabled,
|  | QString | filter,
|  | QColor | foreground,
|  | QColor | background )

Adds a new color rule with specified properties.

Parameters

  disabled | True if the rule is disabled.
  filter | The filter string for the rule.
  foreground | The foreground color.
  background | The background color.

## ◆ addColor() [2/2]

void ColoringRulesModel::addColor | ( | color_filter_t * | colorf | ) |

Adds a new color rule from a core color filter.

Parameters

  colorf | Pointer to the core color filter structure.

## ◆ columnCount()

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

Returns the number of columns under the given parent.

Parameters

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

Returns
  The number of columns in the model.

## ◆ copyRow()

bool ColoringRulesModel::copyRow | ( | int | dst_row,
|  | int | src_row )

Copies a row from one index to another.

Parameters

  dst_row | The destination row index.
  src_row | The source row index.

Returns
  True if the copy was successful, false otherwise.

## ◆ data()

QVariant ColoringRulesModel::data | ( | const QModelIndex & | index,
|  | int | role ) const
| override

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

Parameters

  index | The model index to retrieve data for.
  role | The role for which data is requested.

Returns
  The data associated with the index and role.

## ◆ dropMimeData()

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

Handles dropped MIME data.

Parameters

  data | The MIME data being dropped.
  action | The drop action being performed.
  row | The target row for the drop.
  column | The target column for the drop.
  parent | The target parent index.

Returns
  True if the drop was successful, false otherwise.

## ◆ exportColors()

bool ColoringRulesModel::exportColors | ( | QString | filename,
|  | QString & | err )

Exports the current coloring rules to a file.

Parameters

  filename | The name of the file to export to.
  err | Output string for error messages.

Returns
  True if the export was successful, false otherwise.

## ◆ flags()

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

Retrieves the item flags for a given index.

Parameters

  index | The model index to query.

Returns
  The item flags for the specified index.

## ◆ headerData()

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

Retrieves header data for the given section, orientation, and role.

Parameters

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

Returns
  The header data for the specified parameters.

## ◆ importColors()

bool ColoringRulesModel::importColors | ( | QString | filename,
|  | QString & | err )

Imports coloring rules from a specified file.

Parameters

  filename | The name of the file to import.
  err | Output string for error messages.

Returns
  True if the import was successful, false otherwise.

## ◆ index()

QModelIndex ColoringRulesModel::index | ( | int | row,
|  | int | column,
|  | const QModelIndex & | parent = QModelIndex() ) const
| override

Generates an index for the specified row and column.

Parameters

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

Returns
  The generated model index.

## ◆ insertRows()

bool ColoringRulesModel::insertRows | ( | int | row,
|  | int | count,
|  | const QModelIndex & | parent = QModelIndex() )
| override

Inserts rows into the model.

Parameters

  row | The starting row index for insertion.
  count | The number of rows to insert.
  parent | The parent model index (defaults to an invalid QModelIndex).

Returns
  True if the insertion was successful, false otherwise.

## ◆ mimeData()

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

Generates MIME data for the specified list of indexes.

Parameters

  indexes | The list of indexes to generate data for.

Returns
  A pointer to the generated QMimeData.

## ◆ mimeTypes()

QStringList ColoringRulesModel::mimeTypes | ( |  | ) | const
| override

Retrieves the list of supported MIME types for drag and drop operations.

Returns
  A list of supported MIME type strings.

## ◆ parent()

QModelIndex ColoringRulesModel::parent | ( | const QModelIndex & | indexItem | ) | const
| override

Retrieves the parent index of the specified index.

Parameters

  indexItem | The child model index.

Returns
  The parent model index.

## ◆ removeRows()

bool ColoringRulesModel::removeRows | ( | int | row,
|  | int | count,
|  | const QModelIndex & | parent = QModelIndex() )
| override

Removes rows from the model.

Parameters

  row | The starting row index for removal.
  count | The number of rows to remove.
  parent | The parent model index (defaults to an invalid QModelIndex).

Returns
  True if the removal was successful, false otherwise.

## ◆ rowCount()

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

Returns the number of rows under the given parent.

Parameters

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

Returns
  The number of rows in the model.

## ◆ setData()

bool ColoringRulesModel::setData | ( | const QModelIndex & | index,
|  | const QVariant & | value,
|  | int | role = Qt::EditRole )
| override

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

Parameters

  index | The model index to update.
  value | The value to set.
  role | The role for which data is being set (defaults to Qt::EditRole).

Returns
  True if the data was successfully set, false otherwise.

## ◆ supportedDropActions()

Qt::DropActions ColoringRulesModel::supportedDropActions | ( |  | ) | const
| override

Specifies the supported drag and drop actions.

Returns
  The supported drop actions.

## ◆ writeColors()

bool ColoringRulesModel::writeColors | ( | QString & | err | ) |

Writes the coloring rules to the internal configuration.

Parameters

  err | Output string for error messages.

Returns
  True if writing was successful, false otherwise.

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

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