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

Sort/filter proxy model for the Advanced Preferences pane. More...

#include <pref_models.h>

Inheritance diagram for AdvancedPrefsModel:

Public Types

enum  AdvancedPrefsModelColumn {
  colName = 0 , colStatus , colType , colValue ,
  colLast
}
 Column indices for the Advanced preferences view. More...

Public Member Functions

 AdvancedPrefsModel (QObject *parent=Q_NULLPTR)
 Construct an AdvancedPrefsModel.
virtual bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override
 Determine whether a source row should be included in the view.
void setFilter (const QString &filter)
 Set the text filter applied to preference names and values.
void setShowChangedValues (bool show_changed_values)
 Restrict the view to preferences that differ from their defaults.
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 Return the column header label.
QVariant data (const QModelIndex &index, int role) const override
 Return data for index under role.
Qt::ItemFlags flags (const QModelIndex &index) const override
 Return the item flags for index.
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 Write value to the preference at index.
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Return the number of columns in this model.
void setFirstColumnSpanned (QTreeView *tree, const QModelIndex &index=QModelIndex())
 Mark module-level rows as spanning all columns in tree.

Protected Member Functions

bool filterAcceptItem (PrefsItem &item) const
 Test whether a single PrefsItem passes the current filters.

Detailed Description

Sort/filter proxy model for the Advanced Preferences pane.

Member Enumeration Documentation

◆ AdvancedPrefsModelColumn

Column indices for the Advanced preferences view.

Enumerator
colName 

Preference name.

colStatus 

Default / changed status indicator.

colType 

Preference type string.

colValue 

Current preference value.

colLast 

Sentinel — total column count.

Constructor & Destructor Documentation

◆ AdvancedPrefsModel()

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

Construct an AdvancedPrefsModel.

Parameters
parentThe parent QObject.

Member Function Documentation

◆ columnCount()

int AdvancedPrefsModel::columnCount ( const QModelIndex & parent = QModelIndex()) const
override

Return the number of columns in this model.

Parameters
parentUnused; present for API compatibility.
Returns
Always colLast.

◆ data()

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

Return data for index under role.

Parameters
indexThe proxy model index to query.
roleThe data role.
Returns
The requested data, or an invalid QVariant if unavailable.

◆ filterAcceptItem()

bool AdvancedPrefsModel::filterAcceptItem ( PrefsItem & item) const
protected

Test whether a single PrefsItem passes the current filters.

Parameters
itemThe PrefsItem to evaluate.
Returns
true if item should be included in the filtered view.

◆ filterAcceptsRow()

bool AdvancedPrefsModel::filterAcceptsRow ( int sourceRow,
const QModelIndex & sourceParent ) const
overridevirtual

Determine whether a source row should be included in the view.

A row is accepted if it belongs to the Advanced subtree of the source model and passes the current text filter and changed-values filter.

Parameters
sourceRowThe row index in the source model.
sourceParentThe parent index in the source model.
Returns
true if the row should be shown; false to hide it.

◆ flags()

Qt::ItemFlags AdvancedPrefsModel::flags ( const QModelIndex & index) const
override

Return the item flags for index.

Marks editable preference items with Qt::ItemIsEditable.

Parameters
indexThe proxy model index to query.
Returns
The item flags for the preference at index.

◆ headerData()

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

Return the column header label.

Parameters
sectionColumn index.
orientationMust be Qt::Horizontal.
roleThe data role; typically Qt::DisplayRole.
Returns
The header label for section, or an invalid QVariant.

◆ setData()

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

Write value to the preference at index.

Parameters
indexThe proxy model index of the preference to update.
valueThe new value to apply.
roleThe data role; only Qt::EditRole is handled.
Returns
true if the value was successfully applied; false otherwise.

◆ setFilter()

void AdvancedPrefsModel::setFilter ( const QString & filter)

Set the text filter applied to preference names and values.

Rows whose name or value do not contain filter (case-insensitive) are hidden. An empty string shows all rows.

Parameters
filterThe filter string to apply.

◆ setFirstColumnSpanned()

void AdvancedPrefsModel::setFirstColumnSpanned ( QTreeView * tree,
const QModelIndex & index = QModelIndex() )

Mark module-level rows as spanning all columns in tree.

Keep the internals of model hidden from tree.

Parameters
treeThe QTreeView to update.
indexThe root index from which to start; defaults to the model root.

◆ setShowChangedValues()

void AdvancedPrefsModel::setShowChangedValues ( bool show_changed_values)

Restrict the view to preferences that differ from their defaults.

Parameters
show_changed_valuestrue to show only changed preferences; false to show all preferences.

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