Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
ColumnListModel Class Reference

A table model for managing the list of packet list columns. More...

#include <column_list_model.h>

Inheritance diagram for ColumnListModel:

Public Types

enum  {
  COL_DISPLAYED , COL_TITLE , COL_TYPE , COL_FIELDS ,
  COL_OCCURRENCE , COL_DISPLAY , COL_WIDTH , COL_XALIGN
}
 Enumeration of column identifiers in the column list model. More...
enum  { OriginalType = Qt::UserRole , DisplayedState }
 Enumeration of custom roles used in the column list model. More...

Public Member Functions

 ColumnListModel (QObject *parent=Q_NULLPTR)
 Constructs a new ColumnListModel.
void saveColumns ()
 Saves the current column list to the global configuration.
void addEntry ()
 Adds a new default entry to the end of the column list.
void deleteEntry (int row)
 Deletes a specific entry from the column list.
void reset ()
 Resets the column list to the default configuration.
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 Retrieves header data for the table model.
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Retrieves data from the model.
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Retrieves the number of rows in the model.
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Retrieves the number of columns in the model.
virtual Qt::ItemFlags flags (const QModelIndex &index) const override
 Retrieves the item flags for a given index.
virtual QStringList mimeTypes () const override
 Retrieves the supported MIME types for drag and drop operations.
virtual QMimeData * mimeData (const QModelIndexList &indexes) const override
 Generates MIME data for the specified list of indexes.
virtual Qt::DropActions supportedDropActions () const override
 Specifies the supported drag and drop actions.
virtual bool canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override
 Checks if MIME data can be dropped at a specific location.
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 Handles dropped MIME data to rearrange rows.
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 Sets data in the model for the given index and role.

Static Public Member Functions

static bool displayEnabled (const QModelIndex &index, bool &displayStrings, bool &displayDetails)
 Checks whether the display options are enabled for the given index.

Detailed Description

A table model for managing the list of packet list columns.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Enumeration of column identifiers in the column list model.

Enumerator
COL_DISPLAYED 

Column showing whether the column is currently displayed.

COL_TITLE 

Column showing the column title.

COL_TYPE 

Column showing the column type.

COL_FIELDS 

Column showing the field names used in the column.

COL_OCCURRENCE 

Column showing the occurrence index of the field.

COL_DISPLAY 

Column showing the display format mapping.

COL_WIDTH 

Column showing the width property.

COL_XALIGN 

Column showing the alignment property.

◆ anonymous enum

anonymous enum

Enumeration of custom roles used in the column list model.

Enumerator
OriginalType 

Role for the original, unmodified column type.

DisplayedState 

Role for querying the internal displayed state.

Constructor & Destructor Documentation

◆ ColumnListModel()

ColumnListModel::ColumnListModel ( QObject * parent = Q_NULLPTR)

Constructs a new ColumnListModel.

Parameters
parentThe parent QObject, defaults to Q_NULLPTR.

Member Function Documentation

◆ canDropMimeData()

bool ColumnListModel::canDropMimeData ( const QMimeData * data,
Qt::DropAction action,
int row,
int column,
const QModelIndex & parent ) const
overridevirtual

Checks if MIME data can be dropped at a specific location.

Parameters
dataThe MIME data being dropped.
actionThe drop action.
rowThe target row for the drop.
columnThe target column for the drop.
parentThe target parent model index.
Returns
True if the drop is allowed, false otherwise.

◆ columnCount()

int ColumnListModel::columnCount ( const QModelIndex & parent = QModelIndex()) const
overridevirtual

Retrieves the number of columns in the model.

Parameters
parentThe parent model index.
Returns
The number of columns.

◆ data()

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

Retrieves data from the model.

Parameters
indexThe model index.
roleThe requested data role.
Returns
The data associated with the index and role.

◆ deleteEntry()

void ColumnListModel::deleteEntry ( int row)

Deletes a specific entry from the column list.

Parameters
rowThe row index to delete.

◆ displayEnabled()

bool ColumnListModel::displayEnabled ( const QModelIndex & index,
bool & displayStrings,
bool & displayDetails )
static

Checks whether the display options are enabled for the given index.

Parameters
indexThe model index.
displayStringsOutput boolean indicating if display strings are supported.
displayDetailsOutput boolean indicating if display details are supported.
Returns
True if display options are enabled, false otherwise.

◆ dropMimeData()

bool ColumnListModel::dropMimeData ( const QMimeData * data,
Qt::DropAction action,
int row,
int column,
const QModelIndex & parent )
overridevirtual

Handles dropped MIME data to rearrange rows.

Parameters
dataThe MIME data dropped.
actionThe drop action.
rowThe target row.
columnThe target column.
parentThe target parent index.
Returns
True if the drop was successfully processed, false otherwise.

◆ flags()

Qt::ItemFlags ColumnListModel::flags ( const QModelIndex & index) const
overridevirtual

Retrieves the item flags for a given index.

Parameters
indexThe model index.
Returns
The valid item flags for the index.

◆ headerData()

QVariant ColumnListModel::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const
overridevirtual

Retrieves header data for the table model.

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

◆ mimeData()

QMimeData * ColumnListModel::mimeData ( const QModelIndexList & indexes) const
overridevirtual

Generates MIME data for the specified list of indexes.

Parameters
indexesThe list of indexes to generate data for.
Returns
A pointer to the generated QMimeData.

◆ mimeTypes()

QStringList ColumnListModel::mimeTypes ( ) const
overridevirtual

Retrieves the supported MIME types for drag and drop operations.

Returns
A list of supported MIME type strings.

◆ rowCount()

int ColumnListModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
overridevirtual

Retrieves the number of rows in the model.

Parameters
parentThe parent model index.
Returns
The number of rows.

◆ setData()

bool ColumnListModel::setData ( const QModelIndex & index,
const QVariant & value,
int role = Qt::EditRole )
overridevirtual

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

Parameters
indexThe model index to update.
valueThe value to set.
roleThe data role being set.
Returns
True if the data was successfully updated, false otherwise.

◆ supportedDropActions()

Qt::DropActions ColumnListModel::supportedDropActions ( ) const
overridevirtual

Specifies the supported drag and drop actions.

Returns
The supported drop actions.

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