From a86c5f7cae7ec9a3398300555a0b644689d946a1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:14:53 +0200 Subject: Merging upstream version 4.4.0. Signed-off-by: Daniel Baumann --- ui/qt/widgets/qcp_axis_ticker_elided.h | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 ui/qt/widgets/qcp_axis_ticker_elided.h (limited to 'ui/qt/widgets/qcp_axis_ticker_elided.h') diff --git a/ui/qt/widgets/qcp_axis_ticker_elided.h b/ui/qt/widgets/qcp_axis_ticker_elided.h new file mode 100644 index 00000000..b542d9a9 --- /dev/null +++ b/ui/qt/widgets/qcp_axis_ticker_elided.h @@ -0,0 +1,38 @@ +/** @file + * + * QCustomPlot QCPAxisTickerText subclass that elides labels to the + * width of the parent QCPAxis's QCPAxisRect's margin for the appropriate + * side, for use when the margin is fixed. + * + * Copyright 2024 John Thacker + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QCP_AXIS_TICKER_ELIDED_H +#define QCP_AXIS_TICKER_ELIDED_H + +#include + +class QCPAxisTickerElided : public QCPAxisTickerText +{ +public: + explicit QCPAxisTickerElided(QCPAxis *parent); + + // QCP has marginSideToAxisType but not the inverse + static QCP::MarginSide axisTypeToMarginSide(const QCPAxis::AxisType); + + QString elidedText(const QString& text); + +protected: + virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) override; + +private: + QCPAxis *mParent; +}; + +#endif -- cgit v1.2.3