|
Wireshark 4.7.4
The Wireshark network protocol analyzer
|
A QTreeView clone that shows every row of a PinnedRowsModel (i.e. every currently pinned packet, packed together with no gaps), used to keep pinned packets visible while the primary packet list view scrolls. More...
#include <pinned_row_view.h>
Public Slots | |
| void | setHorizontalScrollValue (int value) |
Public Member Functions | |
| PinnedRowView (PacketList *packet_list, QWidget *parent=nullptr) | |
| Constructs a PinnedRowView. | |
| void | setColumnRange (int first, int last) |
| Restricts which columns this view renders. | |
| bool | isCornerView () const |
| Whether this instance is currently acting as the "corner" widget (the frozen-column portion of the pinned-row strip, shown alongside PinnedColumnView's own frozen-column overlay) rather than the main pinned-row strip covering the remaining columns. | |
| PacketList * | packetList () const |
| The primary PacketList this view mirrors rows for. Used by MultiColorPacketDelegate to compute the scrollbar-adjusted usable width the same way drawRow()'s own scrollbar-sliver calculation does. | |
| void | mirrorSectionWidth (int column, int width) |
| QSize | sizeHint () const override |
| The height needed to show all of this model's rows stacked with no gaps, given the shared row height. 0 if no rows are pinned. | |
Protected Member Functions | |
| void | mousePressEvent (QMouseEvent *event) override |
| Forwards mouse presses to the primary packet list so that selection/marking behavior matches clicking the main view exactly. | |
| void | mouseReleaseEvent (QMouseEvent *event) override |
| void | mouseMoveEvent (QMouseEvent *event) override |
| Reports the row under the mouse to the primary packet list so the hover highlight can be shown across every pane, not just this one. | |
| void | leaveEvent (QEvent *event) override |
| void | contextMenuEvent (QContextMenuEvent *event) override |
| void | wheelEvent (QWheelEvent *event) override |
| void | drawRow (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| Draws the selection and hover highlights (this view's model is a separate proxy, so it can't rely on a shared QItemSelectionModel the way PinnedColumnView does) and the "packet separator" line, mirroring PacketList::drawRow(). | |
| void | resizeEvent (QResizeEvent *event) override |
| Keeps the "corner" boundary-divider widget sized to this view's full height whenever it's resized. | |
| void | paintEvent (QPaintEvent *event) override |
| Refreshes selected_frame_nums_cache_ once per paint pass before deferring to QTreeView's own paintEvent(), which calls drawRow() once per visible row – see the cache's own comment for why this avoids a per-row rescan of the primary view's selection. | |
A QTreeView clone that shows every row of a PinnedRowsModel (i.e. every currently pinned packet, packed together with no gaps), used to keep pinned packets visible while the primary packet list view scrolls.
The same class also serves as the "corner" widget when rows are pinned at the same time as columns are frozen, by restricting the rendered columns via setColumnRange().
|
explicit |
Constructs a PinnedRowView.
| packet_list | The primary PacketList this view mirrors rows for and forwards mouse/context/wheel events to. Kept as an explicit pointer (rather than assuming parentWidget() is the PacketList, which no longer holds now that this widget lives inside PacketListPane's layout alongside, not inside, PacketList). |
| parent | The parent widget. |
|
inline |
Whether this instance is currently acting as the "corner" widget (the frozen-column portion of the pinned-row strip, shown alongside PinnedColumnView's own frozen-column overlay) rather than the main pinned-row strip covering the remaining columns.
Both first_column_ == 0 and last_column_ >= 0 are required: the main pinned-row strip's own range is set to (pinned_column_boundary_, -1), which also starts at column 0 whenever no columns are currently frozen (pinned_column_boundary_ == 0) – first_column_ == 0 alone (what right_divider_'s own visibility already checks, harmlessly there since the corner instance is simply hidden whenever that ambiguity would matter) can't distinguish that case from the corner's own range, which is always a bounded [0, boundary - 1] and so never has last_column_ == -1.
Used by MultiColorPacketDelegate to paint this instance the same flat-fill way as PinnedColumnView – unlike the main pinned-row strip, which follows the primary view's real stripe/shift-right pattern – since the corner only ever shows a narrow, frozen slice of the row, same as PinnedColumnView.
|
overrideprotected |
Refreshes selected_frame_nums_cache_ once per paint pass before deferring to QTreeView's own paintEvent(), which calls drawRow() once per visible row – see the cache's own comment for why this avoids a per-row rescan of the primary view's selection.
Rebuilt unconditionally on every repaint (hover, scroll, resize), not only when the primary view's selection has actually changed: threading a dirty flag through from PacketList::selectionChanged() would avoid the rebuild on paints where selection didn't change, but the cost either way is bounded tightly by PinnedRowsModel::kMaxPinnedRows (currently 10) pinned rows against however many rows are selected in the primary view – not worth the added plumbing for a cost this small and this bounded.
| void PinnedRowView::setColumnRange | ( | int | first, |
| int | last ) |
Restricts which columns this view renders.
| first | First column (logical index, inclusive) to show. |
| last | Last column (logical index, inclusive) to show, or -1 for "through the last column". |