Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
JsonDataSourceView Class Reference

A view for displaying and interacting with JSON formatted data sources. More...

#include <json_data_source_view.h>

Inheritance diagram for JsonDataSourceView:
BaseDataSourceView

Public Slots

void setMonospaceFont (const QFont &mono_font) override
 Sets the monospace font used for rendering the JSON text.
void markField (int start, int length, bool scroll_to=true, bool hover=false) override
 Visually marks a field in the display.
void unmarkField () override
 Clears the currently marked field.
void markProtocol (int start, int length) override
 Marks a protocol in the view (unused for JSON view).
void markAppendix (int start, int length) override
 Marks the appendix in the view (unused for JSON view).
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 fieldSelected (FieldInformation *finfo)
 Signal emitted when a JSON field is selected.
void fieldHighlight (FieldInformation *finfo)
 Signal emitted when a JSON field is hovered or highlighted.
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

 JsonDataSourceView (const QByteArray &data, proto_node *root_node, QWidget *parent=nullptr)
 Constructs a new JsonDataSourceView.
 ~JsonDataSourceView ()
 Destroys the JsonDataSourceView.
Public Member Functions inherited from BaseDataSourceView
 BaseDataSourceView (const QByteArray &data, QWidget *parent=nullptr)
 Construct a BaseDataSourceView.
virtual QSize minimumSizeHint () const override
 Return the minimum size hint for the view.
virtual bool isEmpty () const
 Return whether the view contains no displayable data.
struct tvbufftvb () 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.

Protected Member Functions

virtual void paintEvent (QPaintEvent *) override
 Handles paint events to draw the JSON text.
virtual void resizeEvent (QResizeEvent *) override
 Handles resize events to adjust the text layout.
virtual void showEvent (QShowEvent *) override
 Handles show events.
virtual void keyPressEvent (QKeyEvent *) override
 Handles key press events for navigation.
virtual void mousePressEvent (QMouseEvent *event) override
 Handles mouse press events for selecting fields.
virtual void mouseMoveEvent (QMouseEvent *event) override
 Handles mouse move events for hovering over fields.
virtual void leaveEvent (QEvent *event) override
 Handles leave events to clear hover states.

Additional Inherited Members

Protected Attributes inherited from BaseDataSourceView
QByteArray data_
 The raw packet bytes displayed by this view.

Detailed Description

A view for displaying and interacting with JSON formatted data sources.

Constructor & Destructor Documentation

◆ JsonDataSourceView()

JsonDataSourceView::JsonDataSourceView ( const QByteArray & data,
proto_node * root_node,
QWidget * parent = nullptr )
explicit

Constructs a new JsonDataSourceView.

Parameters
dataThe raw JSON byte data.
root_nodeThe root protocol node of the JSON tree.
parentThe parent widget, defaults to nullptr.

Member Function Documentation

◆ fieldHighlight

void JsonDataSourceView::fieldHighlight ( FieldInformation * finfo)
signal

Signal emitted when a JSON field is hovered or highlighted.

Parameters
finfoPointer to the highlighted field information.

◆ fieldSelected

void JsonDataSourceView::fieldSelected ( FieldInformation * finfo)
signal

Signal emitted when a JSON field is selected.

Parameters
finfoPointer to the selected field information.

◆ leaveEvent()

void JsonDataSourceView::leaveEvent ( QEvent * event)
overrideprotectedvirtual

Handles leave events to clear hover states.

Parameters
eventThe leave event.

◆ markAppendix

void JsonDataSourceView::markAppendix ( int start,
int length )
inlineoverrideslot

Marks the appendix in the view (unused for JSON view).

Parameters
startThe starting byte offset.
lengthThe length in bytes.

◆ markField

void JsonDataSourceView::markField ( int start,
int length,
bool scroll_to = true,
bool hover = false )
overrideslot

Visually marks a field in the display.

Parameters
startThe starting byte offset.
lengthThe length of the field in bytes.
scroll_toTrue to automatically scroll the view to the marked field.
hoverTrue if the field is being marked due to a hover action.

◆ markProtocol

void JsonDataSourceView::markProtocol ( int start,
int length )
inlineoverrideslot

Marks a protocol in the view (unused for JSON view).

Parameters
startThe starting byte offset.
lengthThe length in bytes.

◆ mouseMoveEvent()

void JsonDataSourceView::mouseMoveEvent ( QMouseEvent * event)
overrideprotectedvirtual

Handles mouse move events for hovering over fields.

Parameters
eventThe mouse event.

◆ mousePressEvent()

void JsonDataSourceView::mousePressEvent ( QMouseEvent * event)
overrideprotectedvirtual

Handles mouse press events for selecting fields.

Parameters
eventThe mouse event.

◆ setMonospaceFont

void JsonDataSourceView::setMonospaceFont ( const QFont & mono_font)
overrideslot

Sets the monospace font used for rendering the JSON text.

Parameters
mono_fontThe monospace font to apply.

The documentation for this class was generated from the following files: