13#ifndef PINNED_ROWS_MODEL_H
14#define PINNED_ROWS_MODEL_H
16#include <QAbstractProxyModel>
34class PinnedRowsModel :
public QAbstractProxyModel
41 explicit PinnedRowsModel(QObject *parent =
nullptr);
61 bool isPinned(
int frame_num)
const;
64 int pinnedCount()
const {
return static_cast<int>(pinned_frame_nums_.count()); }
79 void setSourceModel(QAbstractItemModel *source_model)
override;
80 QModelIndex mapToSource(
const QModelIndex &proxy_index)
const override;
81 QModelIndex mapFromSource(
const QModelIndex &source_index)
const override;
82 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
83 QModelIndex parent(
const QModelIndex &child)
const override;
84 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
85 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
103 QVariant
data(
const QModelIndex &proxy_index,
int role)
const override;
114 Qt::ItemFlags
flags(
const QModelIndex &proxy_index)
const override;
129 void sourceDataChanged(
const QModelIndex &source_top_left,
const QModelIndex &source_bottom_right,
130 const QList<int> &roles);
133 QList<int> pinned_frame_nums_;
140 int sourceRowForPinnedIndex(
int proxy_row)
const;
A Qt item model representing the list of packets in a capture file.
Definition packet_list_model.h:36
Qt::ItemFlags flags(const QModelIndex &proxy_index) const override
Returns a pinned row's flags regardless of whether it currently passes the display filter,...
Definition pinned_rows_model.cpp:145
void refresh()
Re-sorts the pinned frames to match the source model's current row order (i.e. whatever sort is curre...
Definition pinned_rows_model.cpp:81
static const int kMaxPinnedRows
Definition pinned_rows_model.h:39
void unpinFrame(int frame_num)
Unpins a packet.
Definition pinned_rows_model.cpp:53
bool pinFrame(int frame_num)
Pins a packet, if not already pinned and under the kMaxPinnedRows cap.
Definition pinned_rows_model.cpp:35
QVariant data(const QModelIndex &proxy_index, int role) const override
Returns a pinned row's data regardless of whether it currently passes the display filter.
Definition pinned_rows_model.cpp:134