QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_abstract_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_ABSTRACT_SCALE_DRAW_H
28#define QWT_ABSTRACT_SCALE_DRAW_H
29
30#include "qwt_global.h"
31#include "qwt_scale_div.h"
32
33class QwtText;
34class QPalette;
35class QPainter;
36class QFont;
37class QwtTransform;
38class QwtScaleMap;
39
54class QWT_EXPORT QwtAbstractScaleDraw
55{
56public:
68 {
70 Backbone = 0x01,
71
73 Ticks = 0x02,
74
76 Labels = 0x04
77 };
78
79 Q_DECLARE_FLAGS(ScaleComponents, ScaleComponent)
80
82 virtual ~QwtAbstractScaleDraw();
83
84 void setScaleDiv(const QwtScaleDiv&);
85 const QwtScaleDiv& scaleDiv() const;
86
87 void setTransformation(QwtTransform*);
88 const QwtScaleMap& scaleMap() const;
89 QwtScaleMap& scaleMap();
90
91 void enableComponent(ScaleComponent, bool enable = true);
92 bool hasComponent(ScaleComponent) const;
93
94 void setTickLength(QwtScaleDiv::TickType, double length);
95 double tickLength(QwtScaleDiv::TickType) const;
96 double maxTickLength() const;
97
98 void setSpacing(double);
99 double spacing() const;
100
101 void setPenWidthF(qreal width);
102 qreal penWidthF() const;
103
104 // Set whether the scale draw is selected
105 void setSelected(bool on);
106 // Check if the scale draw is selected
107 bool isSelected() const;
108
109 // Set the pen width adjustment after selection
110 void setSelectedPenWidthOffset(qreal offset = 1);
111 qreal selectedPenWidthOffset() const;
112
113 virtual void draw(QPainter*, const QPalette&) const;
114
115 virtual QwtText label(double) const;
116
117 // Calculate the extent (distance from baseline to outermost pixel)
118 virtual double extent(const QFont& font) const = 0;
119
120 void setMinimumExtent(double);
121 double minimumExtent() const;
122
123 void invalidateCache();
124
125protected:
142 virtual void drawTick(QPainter* painter, double value, double len) const = 0;
143
156 virtual void drawBackbone(QPainter* painter) const = 0;
157
172 virtual void drawLabel(QPainter* painter, double value) const = 0;
173
174 const QwtText& tickLabel(const QFont&, double value) const;
175
176private:
177 Q_DISABLE_COPY(QwtAbstractScaleDraw)
178
179 class PrivateData;
180 PrivateData* m_data;
181};
182
183Q_DECLARE_OPERATORS_FOR_FLAGS(QwtAbstractScaleDraw::ScaleComponents)
184
185#endif
绘制刻度的抽象基类
Definition qwt_abstract_scale_draw.h:55
virtual void drawBackbone(QPainter *painter) const =0
绘制刻度的基线
ScaleComponent
刻度的组件
Definition qwt_abstract_scale_draw.h:68
virtual void drawTick(QPainter *painter, double value, double len) const =0
绘制刻度线
virtual void drawLabel(QPainter *painter, double value) const =0
绘制主刻度标签
A class representing a scale division/表示刻度划分的类
Definition qwt_scale_div.h:53
TickType
Scale tick types
Definition qwt_scale_div.h:57
刻度映射
Definition qwt_scale_map.h:52
表示文本的类
Definition qwt_text.h:93
坐标系之间的变换
Definition qwt_transform.h:61