Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
pinned_row_view.h
Go to the documentation of this file.
1
12
13#ifndef PINNED_ROW_VIEW_H
14#define PINNED_ROW_VIEW_H
15
16#include <QTreeView>
17#include <QPainter>
18#include <QPersistentModelIndex>
19
20class PacketList;
21
31class PinnedRowView : public QTreeView
32{
33 Q_OBJECT
34public:
44 explicit PinnedRowView(PacketList *packet_list, QWidget *parent = nullptr);
45
52 void setColumnRange(int first, int last);
53
76 bool isCornerView() const { return first_column_ == 0 && last_column_ >= 0; }
77
83 PacketList *packetList() const { return packet_list_; }
84
85 // Mirrors a single section's width from the primary view's header.
86 void mirrorSectionWidth(int column, int width);
87
92 QSize sizeHint() const override;
93
94public slots:
95 // Mirrors the primary view's horizontal scroll position.
96 void setHorizontalScrollValue(int value);
97
98protected:
107 void updateGeometries() override;
108
114 void mousePressEvent(QMouseEvent *event) override;
115
116 // Ends a click, dispatching it to the column's delegate.
117 void mouseReleaseEvent(QMouseEvent *event) override;
118
123 void mouseMoveEvent(QMouseEvent *event) override;
124
125 // Clears the reported hover row when the mouse leaves this view.
126 void leaveEvent(QEvent *event) override;
127
128 // Forwards context menu requests to the primary packet list.
129 void contextMenuEvent(QContextMenuEvent *event) override;
130
131 // Forwards wheel scrolling to the primary packet list.
132 void wheelEvent(QWheelEvent *event) override;
133
138 void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
139
144 void resizeEvent(QResizeEvent *event) override;
145
146private:
147 PacketList *packet_list_;
148 int first_column_;
149 int last_column_;
150
151 // Cell pressed with the left button, used to start a cell drag on the
152 // first mouse move within it (as PacketList does). Invalid when no
153 // drag is armed.
154 QPersistentModelIndex drag_index_;
155
158 QWidget *right_divider_;
159
160 void applyColumnVisibility();
161};
162
163#endif // PINNED_ROW_VIEW_H
The main packet list view for displaying captured packets.
Definition packet_list.h:51
bool isCornerView() const
Whether this instance is currently acting as the "corner" widget (the frozen-column portion of the pi...
Definition pinned_row_view.h:76
void resizeEvent(QResizeEvent *event) override
Keeps the "corner" boundary-divider widget sized to this view's full height whenever it's resized.
Definition pinned_row_view.cpp:317
void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Draws the hover highlight (which spans every pane) and the "packet separator" line,...
Definition pinned_row_view.cpp:241
void mousePressEvent(QMouseEvent *event) override
Selects the clicked pinned row in this view's own selection model (linked to the primary packet list'...
Definition pinned_row_view.cpp:147
void updateGeometries() override
Widens this view's horizontal scroll range to the primary view's. QTreeView derives the range from it...
Definition pinned_row_view.cpp:119
PinnedRowView(PacketList *packet_list, QWidget *parent=nullptr)
Constructs a PinnedRowView.
Definition pinned_row_view.cpp:31
void setColumnRange(int first, int last)
Restricts which columns this view renders.
Definition pinned_row_view.cpp:56
QSize sizeHint() const override
The height needed to show all of this model's rows stacked with no gaps, given the shared row height....
Definition pinned_row_view.cpp:133
void mouseMoveEvent(QMouseEvent *event) override
Reports the row under the mouse to the primary packet list so the hover highlight can be shown across...
Definition pinned_row_view.cpp:182
PacketList * packetList() const
The primary PacketList this view mirrors rows for. Used by MultiColorPacketDelegate to compute the sc...
Definition pinned_row_view.h:83