Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
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)
 Sets the monospace font used for rendering the JSON text.
 
void markField (int start, int length, bool scroll_to=true, bool hover=false)
 Visually marks a field in the display.
 
void unmarkField ()
 Clears the currently marked field.
 
void markProtocol (int start, int length)
 Marks a protocol in the view (unused for JSON view).
 
void markAppendix (int start, int length)
 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
 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 *)
 Handles paint events to draw the JSON text.
 
virtual void resizeEvent (QResizeEvent *)
 Handles resize events to adjust the text layout.
 
virtual void showEvent (QShowEvent *)
 Handles show events.
 
virtual void keyPressEvent (QKeyEvent *)
 Handles key press events for navigation.
 
virtual void mousePressEvent (QMouseEvent *event)
 Handles mouse press events for selecting fields.
 
virtual void mouseMoveEvent (QMouseEvent *event)
 Handles mouse move events for hovering over fields.
 
virtual void leaveEvent (QEvent *event)
 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)
protectedvirtual

Handles leave events to clear hover states.

Parameters
eventThe leave event.

◆ markAppendix

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

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 
)
slot

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 
)
inlineslot

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)
protectedvirtual

Handles mouse move events for hovering over fields.

Parameters
eventThe mouse event.

◆ mousePressEvent()

void JsonDataSourceView::mousePressEvent ( QMouseEvent *  event)
protectedvirtual

Handles mouse press events for selecting fields.

Parameters
eventThe mouse event.

◆ setMonospaceFont

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

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: