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

Base class for preference editor delegates used in the preferences tree view. More...

#include <wireshark_preference.h>

Inheritance diagram for WiresharkPreference:
BoolPreference ColorPreference DirNamePreference EnumPreference OpenFilePreference RangePreference SaveFilePreference StringPreference UatPreference

Public Member Functions

Q_INVOKABLE WiresharkPreference (QObject *parent=Q_NULLPTR)
 Constructs a WiresharkPreference with no associated PrefsItem.
 
virtual QWidget * editor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index)
 Creates and returns an editor widget for the preference at index.
 
virtual void setData (QWidget *editor, const QModelIndex &index)
 Populates the editor widget with the current preference value from the model at index.
 
virtual void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index)
 Writes the editor's current value back to the model.
 
void setPrefsItem (PrefsItem *item)
 Associates a PrefsItem with this preference editor.
 

Protected Member Functions

PrefsItemprefsItem () const
 Returns the PrefsItem associated with this preference editor.
 

Detailed Description

Base class for preference editor delegates used in the preferences tree view.

Subclasses implement editor(), setData(), and setModelData() to provide type-specific inline editors (e.g. spin boxes, combo boxes, colour pickers) for each preference type.

Constructor & Destructor Documentation

◆ WiresharkPreference()

WiresharkPreference::WiresharkPreference ( QObject *  parent = Q_NULLPTR)
explicit

Constructs a WiresharkPreference with no associated PrefsItem.

Parameters
parentOptional parent QObject.

Member Function Documentation

◆ editor()

QWidget * WiresharkPreference::editor ( QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
)
virtual

Creates and returns an editor widget for the preference at index.

Parameters
parentParent widget for the created editor.
optionStyle options for the cell being edited.
indexModel index of the preference cell.
Returns
Pointer to the newly created editor widget, or nullptr if no inline editor is provided by this preference type.

Reimplemented in StringPreference, EnumPreference, RangePreference, ColorPreference, BoolPreference, PasswordPreference, SaveFilePreference, OpenFilePreference, DirNamePreference, and UatPreference.

◆ prefsItem()

PrefsItem * WiresharkPreference::prefsItem ( ) const
protected

Returns the PrefsItem associated with this preference editor.

Returns
Pointer to the associated PrefsItem, or nullptr if none has been set.

◆ setData()

void WiresharkPreference::setData ( QWidget *  editor,
const QModelIndex &  index 
)
virtual

Populates the editor widget with the current preference value from the model at index.

Parameters
editorThe editor widget previously returned by editor().
indexModel index of the preference being edited.

Reimplemented in StringPreference, EnumPreference, RangePreference, and ColorPreference.

◆ setModelData()

void WiresharkPreference::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
)
virtual

Writes the editor's current value back to the model.

Parameters
editorThe editor widget containing the new value.
modelThe model to update.
indexModel index of the preference cell to update.

Reimplemented in StringPreference, EnumPreference, RangePreference, and ColorPreference.

◆ setPrefsItem()

void WiresharkPreference::setPrefsItem ( PrefsItem item)

Associates a PrefsItem with this preference editor.

Parameters
itemPointer to the PrefsItem this editor operates on.

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