|
Wireshark 5.1.0
The Wireshark network protocol analyzer
|
Table model of the distinct value combinations of the counted fields. More...
#include <distribution_model.h>
Public Types | |
| enum | { SortRole = Qt::UserRole + 1 } |
| Item data role holding the typed sort key of a cell. | |
| using | SortKind = DistributionField::SortKind |
| The sort kind of a field, see DistributionField::SortKind. | |
Signals | |
| void | summaryChanged () |
| Emitted when the summary values or hasResult() changed. | |
Public Member Functions | |
| DistributionModel (QObject *parent=nullptr) | |
| Constructs an empty model without fields. | |
| void | setFields (const QList< DistributionField > &fields) |
| Sets the counted fields and removes all rows. | |
| void | clear () |
| Removes all rows and counts, keeps the fields. | |
| bool | addPacket (proto_tree *tree) |
| Counts the field values of one packet. | |
| void | publish () |
| Makes the rows and counts added since the last call visible. | |
| void | setResolveValues (bool resolve) |
| Shows resolved labels instead of the raw values. | |
| bool | hasFields () const |
| Tells whether fields were set. | |
| bool | hasResult () const |
| Tells whether there is a result to describe. | |
| int | countColumn () const |
| Returns the column of the counts. | |
| int | percentColumn () const |
| Returns the column of the percentages. | |
| QString | filterExpression (int row) const |
| Returns the display filter matching a row. | |
| QList< QVariant > | rowData (int row) const |
| Returns the data of a row for copying and saving. | |
| quint64 | count (int row) const |
| Returns the count of a row. | |
| QList< int > | topRows (int n) const |
| Returns the rows with the highest counts. | |
| QString | rowLabel (int row) const |
| Returns a short name of a row. | |
| QStringList | fieldNames () const |
| Returns the names of the counted fields. | |
| int | distinctValues () const |
| Returns the number of published distinct value combinations. | |
| quint64 | packets () const |
| Returns the number of counted packets at the last publish(). | |
| quint64 | observations () const |
| Returns the number of observations at the last publish(). | |
| double | entropy () const |
| Returns the normalized Shannon entropy at the last publish(). | |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
Static Public Member Functions | |
| static bool | supportsField (const header_field_info *hfinfo) |
| Tells whether the values of a field can be counted. | |
| static SortKind | sortKind (enum ftenum type) |
| Returns how the values of a field type sort. | |
| static QString | parseFields (const QStringList &names, QList< DistributionField > &fields) |
| Resolves field names into counted fields. | |
Static Public Attributes | |
| static constexpr int | maxFields = 4 |
| The maximum number of fields that can be counted together. | |
Table model of the distinct value combinations of the counted fields.
Rows are appended while packets are added and become visible only when publish() is called, so a view keeps its selection, scroll position and sort while the counts update. Columns are one per field, then Count and Percent. Without fields the model has the three columns Value, Count and Percent and no rows.
|
explicit |
Constructs an empty model without fields.
| parent | The parent object. |
| bool DistributionModel::addPacket | ( | proto_tree * | tree | ) |
Counts the field values of one packet.
Every combination of the distinct values of the fields is one observation. New rows are not visible before publish().
| tree | The protocol tree of the packet. |
| quint64 DistributionModel::count | ( | int | row | ) | const |
Returns the count of a row.
| row | The row. |
| int DistributionModel::countColumn | ( | ) | const |
Returns the column of the counts.
|
inline |
Returns the number of published distinct value combinations.
|
inline |
Returns the normalized Shannon entropy at the last publish().
| QStringList DistributionModel::fieldNames | ( | ) | const |
Returns the names of the counted fields.
| QString DistributionModel::filterExpression | ( | int | row | ) | const |
Returns the display filter matching a row.
| row | The row. |
|
inline |
Tells whether fields were set.
|
inline |
Tells whether there is a result to describe.
|
inline |
Returns the number of observations at the last publish().
|
inline |
Returns the number of counted packets at the last publish().
|
static |
Resolves field names into counted fields.
The names are expected to have passed the field list checks of FieldFilterEdit (known names or aliases, none empty, at most maxFields). This only checks what is specific to counting. An alias is stored under the abbreviation of its field.
| names | The field names. |
| fields | Receives the resolved fields. |
| int DistributionModel::percentColumn | ( | ) | const |
Returns the column of the percentages.
| void DistributionModel::publish | ( | ) |
Makes the rows and counts added since the last call visible.
Always emits summaryChanged(), also when nothing changed.
| QList< QVariant > DistributionModel::rowData | ( | int | row | ) | const |
Returns the data of a row for copying and saving.
| row | The row. |
| QString DistributionModel::rowLabel | ( | int | row | ) | const |
Returns a short name of a row.
| row | The row. |
| void DistributionModel::setFields | ( | const QList< DistributionField > & | fields | ) |
Sets the counted fields and removes all rows.
| fields | The fields, as returned by parseFields(). |
| void DistributionModel::setResolveValues | ( | bool | resolve | ) |
Shows resolved labels instead of the raw values.
| resolve | True to show the resolved labels. |
|
static |
Returns how the values of a field type sort.
| type | The field type. |
|
static |
Tells whether the values of a field can be counted.
| hfinfo | The field. |
| QList< int > DistributionModel::topRows | ( | int | n | ) | const |
Returns the rows with the highest counts.
| n | The maximum number of rows. |