|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
A fully custom-painted hex dump view for a single packet data source. More...
#include <hex_data_source_view.h>
Classes | |
| struct | ByteViewAnnotation |
| A user-defined color annotation over a byte range. More... | |
Public Slots | |
| void | setMonospaceFont (const QFont &mono_font) |
| Update the monospace font and recalculate layout metrics. | |
| void | updateByteViewSettings () |
| Reload byte-view display preferences and repaint. | |
| void | markProtocol (int start, int length) |
| Highlight the enclosing protocol layer byte range. | |
| void | markField (int start, int length, bool scroll_to=true, bool hover=false) |
| Highlight a specific dissected field byte range. | |
| void | markAppendix (int start, int length) |
| Highlight the appendix (trailing) bytes of the selected field. | |
| void | unmarkField () |
| Clear field, appendix, and hover highlights. | |
Public Slots inherited from BaseDataSourceView | |
| virtual void | setMonospaceFont (const QFont &mono_font)=0 |
| Update the monospace font used to render byte values. | |
| virtual void | detachData () |
Detach the internal QByteArray from any shared copy. | |
| virtual void | markProtocol (int start, int length)=0 |
| Highlight the byte range belonging to the enclosing protocol layer. | |
| virtual void | markField (int start, int length, bool scroll_to=true, bool hover=false)=0 |
| Highlight the byte range for a specific dissected field. | |
| virtual void | markAppendix (int start, int length)=0 |
| Highlight the appendix byte range for the selected field. | |
| virtual void | unmarkField ()=0 |
| Clear all field and appendix highlights. | |
Signals | |
| void | byteViewSettingsChanged () |
| Emitted when any byte-view display setting changes. | |
| void | addAnnotationRequested () |
| Emitted when the user triggers "Add annotation" from the context menu. | |
| void | editAnnotationRequested () |
| Emitted when the user triggers "Edit annotation" from the context menu. | |
| void | removeAnnotationRequested () |
| Emitted when the user triggers "Remove annotation" from the context menu. | |
| void | offsetStartRequested (int byte) |
| Emitted when the user requests a new offset-start marker. | |
| void | offsetEndRequested (int byte) |
| Emitted when the user requests a new offset-end marker. | |
| void | offsetMarkersCleared () |
| Emitted when the user requests that both offset markers be cleared. | |
Signals inherited from BaseDataSourceView | |
| void | byteHovered (int pos) |
| Emitted when the cursor moves over a byte in the view. | |
| void | byteSelected (int pos) |
| Emitted when the user clicks a byte in the view. | |
Public Member Functions | |
| HexDataSourceView (const QByteArray &data, packet_char_enc encoding=PACKET_CHAR_ENC_CHAR_ASCII, QWidget *parent=nullptr) | |
| Construct a HexDataSourceView. | |
| ~HexDataSourceView () | |
Destroy the view and its QTextLayout. | |
| void | setFormat (bytes_view_type format) |
| Set the numeric base used to render hex-panel byte values. | |
| void | setAnnotations (const QVector< ByteViewAnnotation > &annotations) |
| Replace the current set of user annotations. | |
| bool | selectionRange (int *start, int *length) const |
| Return the current byte selection range. | |
| int | selectionAnchor () const |
| Return the selection anchor byte offset. | |
| int | selectionEnd () const |
| Return the byte offset at the end of the current selection. | |
| int | contextByteOffset () const |
| Return the byte offset at which the context menu was invoked. | |
| int | dataSize () const |
| Return the number of bytes in the data buffer. | |
| int | offsetStart () const |
| Return the current offset-start marker byte position. | |
| int | offsetEnd () const |
| Return the current offset-end marker byte position. | |
| void | setOffsetStart (int byte) |
| Set the offset-start marker to the given byte. | |
| void | setOffsetEnd (int byte) |
| Set the offset-end marker to the given byte. | |
| void | clearOffsetMarkers () |
| Clear both offset markers and repaint. | |
| int | selectedFieldStart () const |
| int | selectedFieldLength () const |
| int | selectedProtocolStart () const |
| int | selectedProtocolLength () const |
| bool | selectedFieldIsProtocol () const |
| Return whether the selected field is itself a protocol layer. | |
| bool | selectedFieldUsesOwnRange () const |
| Return whether the selected field defines its own byte range. | |
| void | setSelectedFieldIsProtocol (bool is_protocol) |
| Set whether the selected field is a protocol-level item. | |
| void | setSelectedFieldUsesOwnRange (bool use_own_range) |
| Set whether the selected field uses its own independent range. | |
Public Member Functions inherited from BaseDataSourceView | |
| BaseDataSourceView (const QByteArray &data, QWidget *parent=nullptr) | |
| Construct a BaseDataSourceView. | |
| virtual QSize | minimumSizeHint () const |
| Return the minimum size hint for the view. | |
| virtual bool | isEmpty () const |
| Return whether the view contains no displayable data. | |
| struct tvbuff * | tvb () const |
Return the tvbuff associated with this data source. | |
| void | setTvb (struct tvbuff *tvb) |
Associate a Wireshark tvbuff with this data source. | |
| int | tabIndex () const |
| Return the tab index of this view within the byte-view panel. | |
| void | setTabIndex (int tab_index) |
| Set the tab index for this view. | |
Public Member Functions inherited from IDataPrintable | |
| virtual | ~IDataPrintable () |
| Destroys the IDataPrintable object. | |
Protected Member Functions | |
| virtual void | paintEvent (QPaintEvent *event) |
| Paint all visible rows of the hex dump. | |
| virtual void | resizeEvent (QResizeEvent *event) |
| Recalculate scrollbar ranges and repaint after a resize. | |
| virtual void | showEvent (QShowEvent *event) |
| Ensure the layout is up to date when the widget first becomes visible. | |
| virtual void | mousePressEvent (QMouseEvent *event) |
| Begin a byte selection or move the cursor on mouse press. | |
| virtual void | mouseMoveEvent (QMouseEvent *event) |
| Extend the selection during a mouse drag. | |
| virtual void | mouseReleaseEvent (QMouseEvent *event) |
| Finalise a drag selection on mouse release. | |
| virtual void | leaveEvent (QEvent *event) |
| Clear hover highlights when the pointer leaves the widget. | |
| virtual void | contextMenuEvent (QContextMenuEvent *event) |
| Show the byte-view context menu. | |
| virtual void | keyPressEvent (QKeyEvent *event) |
| Handle keyboard navigation and copy commands. | |
Additional Inherited Members | |
Protected Attributes inherited from BaseDataSourceView | |
| QByteArray | data_ |
| The raw packet bytes displayed by this view. | |
A fully custom-painted hex dump view for a single packet data source.
|
explicit |
Construct a HexDataSourceView.
| data | The raw packet bytes to display. |
| encoding | Character encoding used for the ASCII panel; PACKET_CHAR_ENC_CHAR_ASCII (default) or PACKET_CHAR_ENC_CHAR_EBCDIC. |
| parent | The parent widget; may be nullptr. |
|
signal |
Emitted when any byte-view display setting changes.
Connected to sibling views so all tabs stay in sync when the user changes the format, encoding, or row-width preference.
| int HexDataSourceView::contextByteOffset | ( | ) | const |
Return the byte offset at which the context menu was invoked.
Saved in contextMenuEvent() so that context-menu action slots know which byte the user right-clicked on, independent of the current keyboard selection.
|
protectedvirtual |
Show the byte-view context menu.
| event | The context menu event. |
|
inline |
Return the number of bytes in the data buffer.
data_.size() cast to int. Asserts that the size fits.
|
protectedvirtual |
Handle keyboard navigation and copy commands.
| event | The key press event. |
|
protectedvirtual |
Clear hover highlights when the pointer leaves the widget.
| event | The leave event. |
|
slot |
Highlight the appendix (trailing) bytes of the selected field.
| start | First byte offset of the appendix. |
| length | Number of bytes in the appendix. |
|
slot |
Highlight a specific dissected field byte range.
| start | First byte offset of the field. |
| length | Number of bytes in the field. |
| scroll_to | true (default) to scroll the range into view. |
| hover | true to apply hover coloring rather than selection. |
|
slot |
Highlight the enclosing protocol layer byte range.
| start | First byte offset of the protocol span. |
| length | Number of bytes in the protocol span. |
|
protectedvirtual |
Extend the selection during a mouse drag.
| event | The mouse move event. |
|
protectedvirtual |
Begin a byte selection or move the cursor on mouse press.
| event | The mouse press event. |
|
protectedvirtual |
Finalise a drag selection on mouse release.
| event | The mouse release event. |
|
inline |
Return the current offset-end marker byte position.
|
signal |
Emitted when the user requests a new offset-end marker.
| byte | The byte offset under the cursor at the time of the request. |
|
inline |
Return the current offset-start marker byte position.
|
signal |
Emitted when the user requests a new offset-start marker.
| byte | The byte offset under the cursor at the time of the request. |
|
protectedvirtual |
Paint all visible rows of the hex dump.
| event | Provides the dirty rect used to limit painting. |
|
protectedvirtual |
Recalculate scrollbar ranges and repaint after a resize.
| event | The resize event (unused beyond triggering the update). |
|
inline |
Return whether the selected field is itself a protocol layer.
|
inline |
|
inline |
|
inline |
Return whether the selected field defines its own byte range.
|
inline |
|
inline |
| int HexDataSourceView::selectionAnchor | ( | ) | const |
Return the selection anchor byte offset.
The anchor is the byte where a drag or keyboard selection began. It may be greater than selectionEnd() for backward selections.
| int HexDataSourceView::selectionEnd | ( | ) | const |
Return the byte offset at the end of the current selection.
| bool HexDataSourceView::selectionRange | ( | int * | start, |
| int * | length | ||
| ) | const |
Return the current byte selection range.
| [out] | start | Set to the first selected byte offset, or -1 if there is no selection. |
| [out] | length | Set to the number of selected bytes, or 0. |
| void HexDataSourceView::setAnnotations | ( | const QVector< ByteViewAnnotation > & | annotations | ) |
Replace the current set of user annotations.
| annotations | The new annotation list. |
| void HexDataSourceView::setFormat | ( | bytes_view_type | format | ) |
Set the numeric base used to render hex-panel byte values.
| format | One of the bytes_view_type values: hexadecimal, decimal, octal, or binary. |
|
slot |
Update the monospace font and recalculate layout metrics.
| mono_font | The new monospace font. |
| void HexDataSourceView::setOffsetEnd | ( | int | byte | ) |
Set the offset-end marker to the given byte.
| byte | Zero-based byte offset at which the end marker is placed. |
| void HexDataSourceView::setOffsetStart | ( | int | byte | ) |
Set the offset-start marker to the given byte.
| byte | Zero-based byte offset at which the start marker is placed. |
|
inline |
Set whether the selected field is a protocol-level item.
| is_protocol | true if the item is a protocol node. |
|
inline |
Set whether the selected field uses its own independent range.
| use_own_range | true to use the field's own range. |
|
protectedvirtual |
Ensure the layout is up to date when the widget first becomes visible.
| event | The show event. |