summaryrefslogtreecommitdiffstats
path: root/ui/qt/widgets/qcp_axis_ticker_elided.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
commita86c5f7cae7ec9a3398300555a0b644689d946a1 (patch)
tree39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /ui/qt/widgets/qcp_axis_ticker_elided.h
parentReleasing progress-linux version 4.2.6-1~progress7.99u1. (diff)
downloadwireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz
wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ui/qt/widgets/qcp_axis_ticker_elided.h')
-rw-r--r--ui/qt/widgets/qcp_axis_ticker_elided.h38
1 files changed, 38 insertions, 0 deletions
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 <johnthacker@gmail.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * 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 <ui/qt/widgets/qcustomplot.h>
+
+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