| Wireshark 4.7.3 The Wireshark network protocol analyzer

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

QCPAxisTickerLog specialisation that formats tick labels using SI (metric) prefixes and Wireshark size/packet units, with optional logarithmic tick placement. More...

`#include <qcp_axis_ticker_si.h>`

Inheritance diagram for QCPAxisTickerSi:

## Public Member Functions
| QCPAxisTickerSi (format_size_units_e unit=FORMAT_SIZE_UNIT_PACKETS, QString customUnit=QString(), bool log=false)
| Constructs a QCPAxisTickerSi.
format_size_units_e | getUnit () const
| Returns the current unit system used for label formatting.
void | setUnit (format_size_units_e unit)
| Sets the unit system used for label formatting and invalidates cached ticks.
void | setCustomUnit (QString unit)
| Sets a custom unit suffix used when the unit is FORMAT_SIZE_UNIT_CUSTOM.
void | setLog (bool log)
| Enables or disables logarithmic tick spacing.

## Protected Member Functions
virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) override
| Returns the SI-prefixed, unit-annotated label for the tick at `tick`.
virtual int | getSubTickCount (double tickStep) override
| Returns the number of sub-ticks to place between two major ticks.
virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) override
| Generates the vector of major tick positions for the given range.

## Protected Attributes
format_size_units_e | mUnit
QString | mCustomUnit
bool | mLog

## Detailed Description

QCPAxisTickerLog specialisation that formats tick labels using SI (metric) prefixes and Wireshark size/packet units, with optional logarithmic tick placement.

## Constructor & Destructor Documentation

## ◆ QCPAxisTickerSi()

QCPAxisTickerSi::QCPAxisTickerSi | ( | format_size_units_e | unit = FORMAT_SIZE_UNIT_PACKETS,
|  | QString | customUnit = QString(),
|  | bool | log = false )
| explicit

Constructs a QCPAxisTickerSi.

Parameters

  unit | The unit system to use for label formatting (default: packets).
  customUnit | Optional custom unit suffix string; used when `unit` is FORMAT_SIZE_UNIT_CUSTOM.
  log | `true` to use logarithmic tick spacing; `false` for linear.

## Member Function Documentation

## ◆ createTickVector()

QVector< double > QCPAxisTickerSi::createTickVector | ( | double | tickStep,
|  | const QCPRange & | range )
| override protected virtual

Generates the vector of major tick positions for the given range.

Delegates to the logarithmic or linear strategy depending on `mLog`, then rounds positions to clean SI-prefix boundaries where possible.

Parameters

  tickStep | Ideal distance between ticks as computed by the base class.
  range | Visible axis range for which ticks are needed.

Returns
  Ordered vector of major tick positions in axis coordinates.

## ◆ getSubTickCount()

int QCPAxisTickerSi::getSubTickCount | ( | double | tickStep | ) |
| override protected virtual

Returns the number of sub-ticks to place between two major ticks.

Adjusts sub-tick count based on whether logarithmic or linear spacing is active and the magnitude of `tickStep`.

Parameters

  tickStep | Distance between two adjacent major ticks in axis coordinates.

Returns
  Number of sub-tick intervals between each pair of major ticks.

## ◆ getTickLabel()

QString QCPAxisTickerSi::getTickLabel | ( | double | tick,
|  | const QLocale & | locale,
|  | QChar | formatChar,
|  | int | precision )
| override protected virtual

Returns the SI-prefixed, unit-annotated label for the tick at `tick`.

Parameters

  tick | Axis coordinate of the tick to label.
  locale | Locale used for number formatting.
  formatChar | printf-style format character for numeric values.
  precision | Number of significant digits for the formatted value.

Returns
  Formatted tick label string (e.g. "1.2 MB", "500 pkts").

## ◆ getUnit()

format_size_units_e QCPAxisTickerSi::getUnit | ( |  | ) | const
| inline

Returns the current unit system used for label formatting.

Returns
  The active format_size_units_e value.

## ◆ setCustomUnit()

void QCPAxisTickerSi::setCustomUnit | ( | QString | unit | ) |

Sets a custom unit suffix used when the unit is FORMAT_SIZE_UNIT_CUSTOM.

Parameters

  unit | Custom unit string to append to tick labels.

## ◆ setLog()

void QCPAxisTickerSi::setLog | ( | bool | log | ) |

Enables or disables logarithmic tick spacing.

Parameters

  log | `true` for logarithmic spacing; `false` for linear spacing.

## ◆ setUnit()

void QCPAxisTickerSi::setUnit | ( | format_size_units_e | unit | ) |

Sets the unit system used for label formatting and invalidates cached ticks.

Parameters

  unit | The format_size_units_e value to apply.

## Member Data Documentation

## ◆ mCustomUnit

QString QCPAxisTickerSi::mCustomUnit
| protected

Custom unit suffix, active when mUnit is FORMAT_SIZE_UNIT_CUSTOM.

## ◆ mLog

bool QCPAxisTickerSi::mLog
| protected

`true` when logarithmic tick spacing is enabled.

## ◆ mUnit

format_size_units_e QCPAxisTickerSi::mUnit
| protected

Unit system applied to tick label formatting.

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

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