| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
CustomPlot Class Reference

An extended QCustomPlot widget supporting markers, data points, and their interactions. More...

`#include <customplot.h>`

Inheritance diagram for CustomPlot:

## Public Member Functions
| CustomPlot (QWidget *widget)
| Constructs a new CustomPlot.
| ~CustomPlot ()
| Destroys the CustomPlot.
void | showMarkerDifferences ()
| Shows the calculated differences between visible markers.
void | setDataPointVisibility (const bool visible)
| Sets the visibility of data points on the plot.
QString | currentValue () const
| Retrieves the current value traced by the plot.
void | mouseReleased ()
| Handles mouse release logic specific to the plot markers and interactions.
bool | mousePressed (QPoint pos)
| Handles mouse press logic, returning whether interaction was captured.
void | clearMarkerDifferences ()
| Clears any displayed marker differences.
int | selectedMarker () const
| Retrieves the index of the currently selected marker.
void | markerVisibilityChanged (const Marker *m)
| Handles a visibility change for a specific marker.
void | showMarkersDifference (bool show)
| Toggles the visibility of the difference between markers.
void | addMarkerElements (const Marker *marker)
| Adds plot elements (lines, labels) associated with a marker.
void | deleteMarkersElements ()
| Deletes visual elements for all markers.
void | deleteMarkerElements (const int index)
| Deletes visual elements for a specific marker.
void | addDataPointsMarker (QCPGraph *graph)
| Adds data point markers along a specific graph.
QString | selectedMarker (const int ignoreIdx)
| Retrieves a string identifying the selected marker, optionally ignoring one index.
QVector< Marker * > | markers () const
| Retrieves all markers currently in the plot.
Marker * | addMarker (double x, bool isPosMarker)
| Adds a new marker at the specified X coordinate.
void | deleteMarker (Marker *m)
| Deletes a specific marker.
void | deleteAllMarkers ()
| Deletes all markers from the plot.
QList< const Marker * > | visibleMarkers () const
| Retrieves a list of all currently visible markers.
Marker * | marker (const QString &name)
| Retrieves a marker by its name/identifier.
Marker * | marker (const int idx)
| Retrieves a marker by its index.
Marker * | posMarker ()
| Retrieves the special position marker linked to the tracer.
void | markerMoved (const Marker *m)
| Updates plot visuals when a marker has been moved.

## Protected Member Functions
void | mouseMoveEvent (QMouseEvent *event) override
| Handles mouse movement events for tracking and dragging.
void | axisRemoved (QCPAxis *axis) override
| Handles cleanup when an axis is removed from the plot.

## Detailed Description

An extended QCustomPlot widget supporting markers, data points, and their interactions.

## Constructor & Destructor Documentation

## ◆ CustomPlot()

CustomPlot::CustomPlot | ( | QWidget * | widget | ) |
| explicit

Constructs a new CustomPlot.

Parameters

  widget | The parent widget.

## Member Function Documentation

## ◆ addDataPointsMarker()

void CustomPlot::addDataPointsMarker | ( | QCPGraph * | graph | ) |

Adds data point markers along a specific graph.

Parameters

  graph | The graph to add data points to.

## ◆ addMarker()

Marker * CustomPlot::addMarker | ( | double | x,
|  | bool | isPosMarker )

Adds a new marker at the specified X coordinate.

Parameters

  x | The X coordinate.
  isPosMarker | True if the marker represents the current tracer position.

Returns
  A pointer to the newly created marker.

## ◆ addMarkerElements()

void CustomPlot::addMarkerElements | ( | const Marker * | marker | ) |

Adds plot elements (lines, labels) associated with a marker.

Parameters

  marker | The marker.

## ◆ axisRemoved()

void CustomPlot::axisRemoved | ( | QCPAxis * | axis | ) |
| override protected

Handles cleanup when an axis is removed from the plot.

Parameters

  axis | The axis being removed.

## ◆ currentValue()

QString CustomPlot::currentValue | ( |  | ) | const
| inline

Retrieves the current value traced by the plot.

Returns
  The value formatted as a string.

## ◆ deleteMarker()

void CustomPlot::deleteMarker | ( | Marker * | m | ) |

Deletes a specific marker.

Parameters

  m | The marker to delete.

## ◆ deleteMarkerElements()

void CustomPlot::deleteMarkerElements | ( | const int | index | ) |

Deletes visual elements for a specific marker.

Parameters

  index | The index of the marker.

## ◆ marker() [1/2]

Marker * CustomPlot::marker | ( | const int | idx | ) |

Retrieves a marker by its index.

Parameters

  idx | The index of the marker.

Returns
  A pointer to the marker, or nullptr if not found.

## ◆ marker() [2/2]

Marker * CustomPlot::marker | ( | const QString & | name | ) |

Retrieves a marker by its name/identifier.

Parameters

  name | The identifier of the marker.

Returns
  A pointer to the marker, or nullptr if not found.

## ◆ markerMoved()

void CustomPlot::markerMoved | ( | const Marker * | m | ) |

Updates plot visuals when a marker has been moved.

Parameters

  m | The marker that moved.

## ◆ markers()

QVector< Marker * > CustomPlot::markers | ( |  | ) | const
| inline

Retrieves all markers currently in the plot.

Returns
  A vector of marker pointers.

## ◆ markerVisibilityChanged()

void CustomPlot::markerVisibilityChanged | ( | const Marker * | m | ) |

Handles a visibility change for a specific marker.

Parameters

  m | The marker whose visibility changed.

## ◆ mouseMoveEvent()

void CustomPlot::mouseMoveEvent | ( | QMouseEvent * | event | ) |
| override protected

Handles mouse movement events for tracking and dragging.

Parameters

  event | The mouse event.

## ◆ mousePressed()

bool CustomPlot::mousePressed | ( | QPoint | pos | ) |

Handles mouse press logic, returning whether interaction was captured.

Parameters

  pos | The position of the mouse press.

Returns
  True if a plot interaction was handled, false otherwise.

## ◆ posMarker()

Marker * CustomPlot::posMarker | ( |  | ) |

Retrieves the special position marker linked to the tracer.

Returns
  A pointer to the position marker.

## ◆ selectedMarker() [1/2]

int CustomPlot::selectedMarker | ( |  | ) | const
| inline

Retrieves the index of the currently selected marker.

Returns
  The selected marker index.

## ◆ selectedMarker() [2/2]

QString CustomPlot::selectedMarker | ( | const int | ignoreIdx | ) |

Retrieves a string identifying the selected marker, optionally ignoring one index.

Parameters

  ignoreIdx | The index to ignore.

Returns
  The marker identification string.

## ◆ setDataPointVisibility()

void CustomPlot::setDataPointVisibility | ( | const bool | visible | ) |

Sets the visibility of data points on the plot.

Parameters

  visible | True to show data points, false to hide them.

## ◆ showMarkersDifference()

void CustomPlot::showMarkersDifference | ( | bool | show | ) |
| inline

Toggles the visibility of the difference between markers.

Parameters

  show | True to show the difference, false to hide it.

## ◆ visibleMarkers()

QList< const Marker * > CustomPlot::visibleMarkers | ( |  | ) | const

Retrieves a list of all currently visible markers.

Returns
  A list of visible marker pointers.

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

- /builds/wireshark/wireshark/ui/qt/widgets/customplot.h
- /builds/wireshark/wireshark/ui/qt/widgets/customplot.cpp