Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | Protected Member Functions | List of all members
SequenceDiagram Class Reference

QCustomPlot plottable that renders a Wireshark sequence diagram, drawing arrows and comments between participant columns for each analysed protocol exchange. More...

#include <sequence_diagram.h>

Inheritance diagram for SequenceDiagram:

Public Slots

void setSelectedPacket (int selected_packet)
 Selects the data point corresponding to selected_packet and updates selected_key_ and selected_packet_ accordingly.
 

Public Member Functions

 SequenceDiagram (QCPAxis *keyAxis, QCPAxis *valueAxis, QCPAxis *commentAxis)
 Constructs a SequenceDiagram plottable with three axes.
 
virtual ~SequenceDiagram ()
 Destroys the SequenceDiagram and frees the internal data map.
 
int adjacentPacket (bool next)
 Returns the frame number of the packet adjacent to the current selection.
 
double selectedKey ()
 Returns the plot key coordinate of the currently selected data point.
 
void setData (struct _seq_analysis_info *sainfo)
 Replaces the diagram's data with the contents of sainfo and triggers a replot.
 
struct _seq_analysis_itemitemForPosY (int ypos)
 Returns the sequence analysis item rendered at the given vertical pixel position in the plot.
 
bool inComment (QPoint pos) const
 Returns whether pos falls within a comment text region.
 
QString elidedComment (const QString &text) const
 Returns text elided to fit within the comment axis width.
 
virtual void clearData ()
 Removes all data points from the internal data map.
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE
 Returns the distance from pos to the nearest data point for hit-testing and selection purposes.
 

Protected Member Functions

virtual void draw (QCPPainter *painter) Q_DECL_OVERRIDE
 Draws all sequence diagram arrows, participant labels, and comment text onto painter.
 
virtual void drawLegendIcon (QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE
 Draws a small representative icon for the legend entry.
 
virtual QCPRange getKeyRange (bool &validRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE
 Returns the key-axis range spanned by the data.
 
virtual QCPRange getValueRange (bool &validRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE
 Returns the value-axis range spanned by the data.
 

Detailed Description

QCustomPlot plottable that renders a Wireshark sequence diagram, drawing arrows and comments between participant columns for each analysed protocol exchange.

Constructor & Destructor Documentation

◆ SequenceDiagram()

SequenceDiagram::SequenceDiagram ( QCPAxis *  keyAxis,
QCPAxis *  valueAxis,
QCPAxis *  commentAxis 
)
explicit

Constructs a SequenceDiagram plottable with three axes.

Parameters
keyAxisAxis used for the key (time/sequence) dimension.
valueAxisAxis used for the value (participant column) dimension.
commentAxisAxis used to render per-arrow comment text.

Member Function Documentation

◆ adjacentPacket()

int SequenceDiagram::adjacentPacket ( bool  next)

Returns the frame number of the packet adjacent to the current selection.

Parameters
nexttrue to retrieve the next packet; false for the previous.
Returns
Frame number of the adjacent packet, or -1 if none exists.

◆ draw()

void SequenceDiagram::draw ( QCPPainter *  painter)
protectedvirtual

Draws all sequence diagram arrows, participant labels, and comment text onto painter.

Parameters
painterQCustomPlot painter to render with.

◆ drawLegendIcon()

void SequenceDiagram::drawLegendIcon ( QCPPainter *  painter,
const QRectF &  rect 
) const
protectedvirtual

Draws a small representative icon for the legend entry.

Parameters
painterQCustomPlot painter to render with.
rectBounding rectangle allocated for the legend icon.

◆ elidedComment()

QString SequenceDiagram::elidedComment ( const QString &  text) const

Returns text elided to fit within the comment axis width.

Parameters
textFull comment string to elide.
Returns
Elided string with a trailing ellipsis if truncation was needed.

◆ getKeyRange()

QCPRange SequenceDiagram::getKeyRange ( bool &  validRange,
QCP::SignDomain  inSignDomain = QCP::sdBoth 
) const
protectedvirtual

Returns the key-axis range spanned by the data.

Parameters
validRangeSet to true if a non-empty range was found.
inSignDomainRestricts the range to positive or negative values.
Returns
QCPRange covering all key values in the data map.

◆ getValueRange()

QCPRange SequenceDiagram::getValueRange ( bool &  validRange,
QCP::SignDomain  inSignDomain = QCP::sdBoth,
const QCPRange &  inKeyRange = QCPRange() 
) const
protectedvirtual

Returns the value-axis range spanned by the data.

Parameters
validRangeSet to true if a non-empty range was found.
inSignDomainRestricts the range to positive or negative values.
inKeyRangeOptional key range to restrict which data points are considered.
Returns
QCPRange covering all value (participant column) positions in the data map.

◆ inComment()

bool SequenceDiagram::inComment ( QPoint  pos) const

Returns whether pos falls within a comment text region.

Parameters
posPoint in widget coordinates to test.
Returns
true if the point is over a comment label.

◆ itemForPosY()

_seq_analysis_item * SequenceDiagram::itemForPosY ( int  ypos)

Returns the sequence analysis item rendered at the given vertical pixel position in the plot.

Parameters
yposY pixel coordinate (in widget space) to hit-test.
Returns
Pointer to the matching _seq_analysis_item, or nullptr if none.

◆ selectedKey()

double SequenceDiagram::selectedKey ( )
inline

Returns the plot key coordinate of the currently selected data point.

Returns
Selected key value, or 0.0 if nothing is selected.

◆ selectTest()

double SequenceDiagram::selectTest ( const QPointF &  pos,
bool  onlySelectable,
QVariant *  details = 0 
) const
virtual

Returns the distance from pos to the nearest data point for hit-testing and selection purposes.

Parameters
posPosition in plot coordinates to test.
onlySelectableIf true, only consider selectable plottables.
detailsOptional output for selection detail data.
Returns
Distance in pixels, or a negative value if the position is not near any point.

◆ setData()

void SequenceDiagram::setData ( struct _seq_analysis_info sainfo)

Replaces the diagram's data with the contents of sainfo and triggers a replot.

Parameters
sainfoPointer to the sequence analysis info structure to visualise.

◆ setSelectedPacket

void SequenceDiagram::setSelectedPacket ( int  selected_packet)
slot

Selects the data point corresponding to selected_packet and updates selected_key_ and selected_packet_ accordingly.

Parameters
selected_packetFrame number of the packet to select.

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