10#ifndef SUPPORTED_PROTOCOLS_MODEL_H
11#define SUPPORTED_PROTOCOLS_MODEL_H
19#include <QSortFilterProxyModel>
57 QString
name()
const {
return name_; }
69 QString
filter()
const {
return filter_; }
131 QModelIndex
index(
int row,
int column,
132 const QModelIndex &
parent = QModelIndex())
const override;
139 QModelIndex
parent(
const QModelIndex &
index)
const override;
147 QVariant
data(
const QModelIndex &
index,
int role)
const override;
156 QVariant
headerData(
int section, Qt::Orientation orientation,
157 int role = Qt::DisplayRole)
const override;
164 int rowCount(
const QModelIndex &
parent = QModelIndex())
const override;
205 virtual bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const override;
221 bool lessThan(
const QModelIndex &source_left,
const QModelIndex &source_right)
const override;
ModelHelperTreeItem(SupportedProtocolsItem *parent)
Definition tree_model_helpers.h:31
Tree item representing a single protocol or protocol field in the Supported Protocols tree,...
Definition supported_protocols_model.h:27
SupportedProtocolsItem(protocol_t *proto, const char *name, const char *filter, ftenum_t ftype, const char *descr, SupportedProtocolsItem *parent)
Constructs a supported-protocols tree item.
Definition supported_protocols_model.cpp:19
protocol_t * protocol() const
Returns the protocol descriptor associated with this item.
Definition supported_protocols_model.h:51
QString description() const
Returns the human-readable description of this protocol or field.
Definition supported_protocols_model.h:75
virtual ~SupportedProtocolsItem()
Destroys the item and all of its child items.
Definition supported_protocols_model.cpp:29
QString name() const
Returns the display name of the protocol or field.
Definition supported_protocols_model.h:57
ftenum_t type() const
Returns the field type of this item.
Definition supported_protocols_model.h:63
QString filter() const
Returns the filter expression string for this protocol or field.
Definition supported_protocols_model.h:69
SupportedProtocolsColumn
Column indices for the supported-protocols tree view.
Definition supported_protocols_model.h:110
@ colType
Definition supported_protocols_model.h:113
@ colDescription
Definition supported_protocols_model.h:114
@ colFilter
Definition supported_protocols_model.h:112
@ colLast
Definition supported_protocols_model.h:115
@ colName
Definition supported_protocols_model.h:111
int fieldCount()
Returns the total number of protocol fields loaded by populate().
Definition supported_protocols_model.h:122
QVariant data(const QModelIndex &index, int role) const override
Returns data for the given model index and role.
Definition supported_protocols_model.cpp:129
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns column header labels for the supported-protocols table.
Definition supported_protocols_model.cpp:68
QModelIndex parent(const QModelIndex &index) const override
Returns the parent index of the item at index.
Definition supported_protocols_model.cpp:88
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of child rows under parent.
Definition supported_protocols_model.cpp:46
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns in the model.
Definition supported_protocols_model.cpp:63
void populate()
Populates the model by iterating all registered protocols and their fields; must be called before the...
Definition supported_protocols_model.cpp:157
SupportedProtocolsModel(QObject *parent=Q_NULLPTR)
Constructs an empty model; call populate() to load protocol data.
Definition supported_protocols_model.cpp:34
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the model index for the item at row and column under parent.
Definition supported_protocols_model.cpp:107
virtual ~SupportedProtocolsModel()
Destroys the model and all tree items.
Definition supported_protocols_model.cpp:41
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Determines whether the source row should be visible given the current filter.
Definition supported_protocols_model.cpp:230
void setFilter(const QString &filter)
Sets the text filter used to match protocols and fields. An empty string shows all items.
Definition supported_protocols_model.cpp:258
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override
Compares two source rows for sorting using the active sort column.
Definition supported_protocols_model.cpp:197
SupportedProtocolsProxyModel(QObject *parent=Q_NULLPTR)
Constructs the proxy model.
Definition supported_protocols_model.cpp:191
bool filterAcceptItem(SupportedProtocolsItem &item) const
Tests whether a single SupportedProtocolsItem matches the current filter.
Definition supported_protocols_model.cpp:212
enum ftenum ftenum_t
Convenience typedef for ftenum.
Definition ftypes.h:190
struct _protocol protocol_t
Definition proto.h:100