QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
qwt_scale_draw.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *
9 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_SCALE_DRAW_H
28#define QWT_SCALE_DRAW_H
29
30#include "qwt_global.h"
31#include "qwt_abstract_scale_draw.h"
32
33#include <qpoint.h>
34
35class QTransform;
36class QSizeF;
37class QRectF;
38class QRect;
39
51class QWT_EXPORT QwtScaleDraw : public QwtAbstractScaleDraw
52{
53public:
59 {
62
65
68
70 RightScale
71 };
72
74 ~QwtScaleDraw() override;
75
91 {
93 NoMiter = 0x0,
94
96 MiterAtStart = 0x1,
97
99 MiterAtEnd = 0x2
100 };
101
102 Q_DECLARE_FLAGS(CornerMiter, CornerMiterFlag)
103
104
105 void setCornerMiter(CornerMiter miter);
107 CornerMiter cornerMiter() const;
108
125 {
127 qreal start = qQNaN();
129 qreal end = qQNaN();
130
132 qreal startWidth = 1.0;
134 qreal endWidth = 1.0;
135 };
136
138 void setCornerTargets(const CornerTargets& targets);
140 CornerTargets cornerTargets() const;
141
143 void getBorderDistHint(const QFont&, int& start, int& end) const;
145 int minLabelDist(const QFont&) const;
146
148 int minLength(const QFont&) const;
149 virtual double extent(const QFont&) const override;
150
151 void move(double x, double y);
152 void move(const QPointF&);
153 void setLength(double length);
154
156 Alignment alignment() const;
158 void setAlignment(Alignment);
159
161 Qt::Orientation orientation() const;
162
164 QPointF pos() const;
166 double length() const;
167
169 void setLabelAlignment(Qt::Alignment);
171 Qt::Alignment labelAlignment() const;
172
174 void setLabelRotation(double rotation);
176 double labelRotation() const;
177
179 int maxLabelHeight(const QFont&) const;
181 int maxLabelWidth(const QFont&) const;
182
184 QPointF labelPosition(double value) const;
185
187 QRectF labelRect(const QFont&, double value) const;
189 QSizeF labelSize(const QFont&, double value) const;
190
192 QRect boundingLabelRect(const QFont&, double value) const;
193
195 void drawTicksInside(QPainter*, const QRectF& canvasRect, const QwtScaleMap&) const;
196
197protected:
198 QTransform labelTransformation(const QPointF&, const QSizeF&) const;
199
200 virtual void drawTick(QPainter*, double value, double len) const override;
201
202 virtual void drawBackbone(QPainter*) const override;
203 virtual void drawLabel(QPainter*, double value) const override;
204
205private:
206 void updateMap();
207
208 QWT_DECLARE_PRIVATE(QwtScaleDraw)
209};
210
211Q_DECLARE_OPERATORS_FOR_FLAGS(QwtScaleDraw::CornerMiter)
212
213
219inline void QwtScaleDraw::move(double x, double y)
220{
221 move(QPointF(x, y));
222}
223
224#endif
An abstract base class for drawing scales.
Definition qwt_abstract_scale_draw.h:47
A class for drawing scales.
Definition qwt_scale_draw.h:52
Alignment
Alignment of the scale draw.
Definition qwt_scale_draw.h:59
@ BottomScale
The scale is below.
Definition qwt_scale_draw.h:61
@ TopScale
The scale is above.
Definition qwt_scale_draw.h:64
@ LeftScale
The scale is left.
Definition qwt_scale_draw.h:67
CornerMiterFlag
Corner miter flags.
Definition qwt_scale_draw.h:91
A scale map.
Definition qwt_scale_map.h:44
Corner miter target positions in device coordinates.
Definition qwt_scale_draw.h:125