|
Wireshark 5.1.0
The Wireshark network protocol analyzer
|
A Qt item model representing the list of packets in a capture file. More...
#include <packet_list_model.h>
Public Types | |
| enum | { HEADER_CAN_DISPLAY_STRINGS = Qt::UserRole , HEADER_CAN_DISPLAY_DETAILS , COLORING_RULE_COLORS } |
| Custom roles. More... | |
Public Slots | |
| void | flushNewRows () |
| Inserts the rows for any packets appended since the last flush. | |
Signals | |
| void | packetAppended (capture_file *cap_file, frame_data *fdata, qsizetype row) |
| Signal emitted when a packet is successfully appended. | |
Public Member Functions | |
| PacketListModel (QObject *parent=0, capture_file *cf=NULL) | |
| Constructs a new PacketListModel. | |
| ~PacketListModel () | |
| Destroys the PacketListModel. | |
| void | setCaptureFile (capture_file *cf) |
| Sets the capture file for the model. | |
| capture_file * | captureFile () const |
| Returns the capture file associated with the model. | |
| QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
| Returns the index of the item in the model. | |
| QModelIndex | parent (const QModelIndex &) const override |
| Returns the parent of the model item. | |
| PacketListRecord * | physicalRecordForFrameNum (int frame_num) const |
| Retrieves the PacketListRecord for a given frame/packet number regardless of whether it currently passes the display filter. This looks the record up directly among physical_rows_ – every packet ever appended, retained permanently in frame-number order, including any not yet inserted as rows (see flushNewRows()) – so callers that need a packet's data independent of the current display filter (e.g. rendering a pinned row that's been filtered out) can still get at it. | |
| PacketListRecord * | physicalRecordAt (int row) const |
| Retrieves the PacketListRecord at the given row. | |
| bool | isEmpty () const |
| Returns true if no packets have been appended. | |
| void | clear () |
| Clears the model data. | |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| Returns the number of rows under the given parent. | |
| int | columnCount (const QModelIndex &=QModelIndex()) const override |
| Returns the number of columns. | |
| Qt::ItemFlags | flags (const QModelIndex &index) const override |
| Returns the item flags for the given index. | |
| QVariant | data (const QModelIndex &d_index, int role) const override |
| Returns the data stored under the given role for the specified index. | |
| QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
| Returns the data for the given role and section in the header. | |
| int | appendPacket (frame_data *fdata) |
| Appends a packet to the model. The row is inserted the next time flushNewRows() runs, which is scheduled automatically. | |
| void | invalidateAllColumnStrings () |
| Invalidate any cached column strings. | |
| void | resetColumns () |
| Rebuild columns from settings. | |
| void | resetColorized () |
| Resets the colorized state for all rows. | |
| void | toggleFrameMark (const QModelIndexList &indices) |
| Toggles the mark state for the specified frames. | |
| void | setFrameMark (const QVector< PacketListRecord * > &records, bool set) |
| Sets the mark state for the given frames. | |
| void | toggleFrameIgnore (const QModelIndexList &indices) |
| Toggles the ignore state for the specified frames. | |
| void | setFrameIgnore (const QVector< PacketListRecord * > &records, bool set) |
| Sets the ignore state for the given frames. | |
| void | toggleFrameRefTime (const QModelIndexList &indices) |
| Toggles the reference time state for the specified frames. | |
| void | unsetAllFrameRefTime () |
| Unsets the reference time state for all frames. | |
| void | addFrameComment (const QModelIndexList &indices, const QByteArray &comment) |
| Adds a comment to the specified frames. | |
| void | setFrameComment (const QModelIndex &index, const QByteArray &comment, unsigned c_number) |
| Sets a specific comment on a frame. | |
| void | deleteFrameComments (const QModelIndexList &indices) |
| Deletes comments from the specified frames. | |
| void | deleteAllFrameComments () |
| Deletes all frame comments from all frames. | |
A Qt item model representing the list of packets in a capture file.
There is one row for every packet appended, in frame number order (so frame N is row N - 1), regardless of the display filter. Filtering and sorting are done by a proxy model such as PacketListProxyModel.
| anonymous enum |
Custom roles.
| Enumerator | |
|---|---|
| HEADER_CAN_DISPLAY_STRINGS | Role indicating if the header can display strings. |
| HEADER_CAN_DISPLAY_DETAILS | Role indicating if the header can display details. |
| COLORING_RULE_COLORS | Item data: QList<ColoringRuleColors>, the colors the packet is drawn with (ColoringRuleUtils::matchColors()). |
|
explicit |
Constructs a new PacketListModel.
| parent | The parent QObject, defaults to 0. |
| cf | The capture file associated with the model, defaults to NULL. |
| void PacketListModel::addFrameComment | ( | const QModelIndexList & | indices, |
| const QByteArray & | comment ) |
Adds a comment to the specified frames.
| indices | List of model indices to comment on. |
| comment | The comment text as a byte array. |
| int PacketListModel::appendPacket | ( | frame_data * | fdata | ) |
Appends a packet to the model. The row is inserted the next time flushNewRows() runs, which is scheduled automatically.
| fdata | Pointer to the frame data. |
|
inline |
Returns the capture file associated with the model.
|
override |
Returns the number of columns.
|
override |
Returns the data stored under the given role for the specified index.
| d_index | The model index. |
| role | The display role. |
| void PacketListModel::deleteFrameComments | ( | const QModelIndexList & | indices | ) |
Deletes comments from the specified frames.
| indices | List of model indices to remove comments from. |
|
override |
Returns the item flags for the given index.
| index | The model index. |
|
override |
Returns the data for the given role and section in the header.
| section | The header section. |
| orientation | The header orientation. |
| role | The display role. |
|
override |
Returns the index of the item in the model.
| row | The row of the item. |
| column | The column of the item. |
| parent | The parent index, defaults to QModelIndex(). |
|
signal |
Signal emitted when a packet is successfully appended.
| cap_file | Pointer to the capture file. |
| fdata | Pointer to the frame data. |
| row | The row index where the packet was added. |
|
override |
Returns the parent of the model item.
| PacketListRecord * PacketListModel::physicalRecordAt | ( | int | row | ) | const |
Retrieves the PacketListRecord at the given row.
| row | The row index (the frame number - 1). |
| PacketListRecord * PacketListModel::physicalRecordForFrameNum | ( | int | frame_num | ) | const |
Retrieves the PacketListRecord for a given frame/packet number regardless of whether it currently passes the display filter. This looks the record up directly among physical_rows_ – every packet ever appended, retained permanently in frame-number order, including any not yet inserted as rows (see flushNewRows()) – so callers that need a packet's data independent of the current display filter (e.g. rendering a pinned row that's been filtered out) can still get at it.
| frame_num | The frame/packet number. |
|
override |
Returns the number of rows under the given parent.
| parent | The parent model index. |
| void PacketListModel::setCaptureFile | ( | capture_file * | cf | ) |
Sets the capture file for the model.
| cf | Pointer to the capture file. |
| void PacketListModel::setFrameComment | ( | const QModelIndex & | index, |
| const QByteArray & | comment, | ||
| unsigned | c_number ) |
Sets a specific comment on a frame.
| index | The model index of the frame. |
| comment | The comment text. |
| c_number | The comment number index. |
| void PacketListModel::setFrameIgnore | ( | const QVector< PacketListRecord * > & | records, |
| bool | set ) |
Sets the ignore state for the given frames.
| records | The records of the frames to change. |
| set | True to ignore, false to un-ignore. |
| void PacketListModel::setFrameMark | ( | const QVector< PacketListRecord * > & | records, |
| bool | set ) |
Sets the mark state for the given frames.
| records | The records of the frames to change. |
| set | True to mark, false to unmark. |
| void PacketListModel::toggleFrameIgnore | ( | const QModelIndexList & | indices | ) |
Toggles the ignore state for the specified frames.
| indices | List of model indices to toggle. |
| void PacketListModel::toggleFrameMark | ( | const QModelIndexList & | indices | ) |
Toggles the mark state for the specified frames.
| indices | List of model indices to toggle. |
| void PacketListModel::toggleFrameRefTime | ( | const QModelIndexList & | indices | ) |
Toggles the reference time state for the specified frames.
| indices | List of model indices to toggle |