QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
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
77 void getBorderDistHint(const QFont&, int& start, int& end) const;
79 int minLabelDist(const QFont&) const;
80
82 int minLength(const QFont&) const;
83 virtual double extent(const QFont&) const override;
84
85 void move(double x, double y);
86 void move(const QPointF&);
87 void setLength(double length);
88
90 Alignment alignment() const;
92 void setAlignment(Alignment);
93
95 Qt::Orientation orientation() const;
96
98 QPointF pos() const;
100 double length() const;
101
103 void setLabelAlignment(Qt::Alignment);
105 Qt::Alignment labelAlignment() const;
106
108 void setLabelRotation(double rotation);
110 double labelRotation() const;
111
113 int maxLabelHeight(const QFont&) const;
115 int maxLabelWidth(const QFont&) const;
116
118 QPointF labelPosition(double value) const;
119
121 QRectF labelRect(const QFont&, double value) const;
123 QSizeF labelSize(const QFont&, double value) const;
124
126 QRect boundingLabelRect(const QFont&, double value) const;
127
128protected:
129 QTransform labelTransformation(const QPointF&, const QSizeF&) const;
130
131 virtual void drawTick(QPainter*, double value, double len) const override;
132
133 virtual void drawBackbone(QPainter*) const override;
134 virtual void drawLabel(QPainter*, double value) const override;
135
136private:
137 void updateMap();
138
139 QWT_DECLARE_PRIVATE(QwtScaleDraw)
140};
141
148inline void QwtScaleDraw::move(double x, double y)
149{
150 move(QPointF(x, y));
151}
152
153#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
void move(double x, double y)
Move the position of the scale
Definition qwt_scale_draw.h:148
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