QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_abstract_scale.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_H
28#define QWT_ABSTRACT_SCALE_H
29
30#include "qwt_global.h"
31#include <qwidget.h>
32
33class QwtScaleEngine;
35class QwtScaleDiv;
36class QwtScaleMap;
37class QwtInterval;
38
50class QWT_EXPORT QwtAbstractScale : public QWidget
51{
52 Q_OBJECT
53
54 Q_PROPERTY(double lowerBound READ lowerBound WRITE setLowerBound)
55 Q_PROPERTY(double upperBound READ upperBound WRITE setUpperBound)
56
57 Q_PROPERTY(int scaleMaxMajor READ scaleMaxMajor WRITE setScaleMaxMajor)
58 Q_PROPERTY(int scaleMaxMinor READ scaleMaxMinor WRITE setScaleMaxMinor)
59
60 Q_PROPERTY(double scaleStepSize READ scaleStepSize WRITE setScaleStepSize)
61
62public:
63 // Constructor for QwtAbstractScale
64 explicit QwtAbstractScale(QWidget* parent = nullptr);
65
66 // Destructor for QwtAbstractScale
67 ~QwtAbstractScale() override;
68
69 // Set scale by lower and upper bounds
70 void setScale(double lowerBound, double upperBound);
71
72 // Set scale by interval
73 void setScale(const QwtInterval&);
74
75 // Set scale by scale division
76 void setScale(const QwtScaleDiv&);
77
78 // Return the current scale division
79 const QwtScaleDiv& scaleDiv() const;
80
81 // Set the lower bound of the scale
82 void setLowerBound(double value);
83
84 // Return the lower bound of the scale
85 double lowerBound() const;
86
87 // Set the upper bound of the scale
88 void setUpperBound(double value);
89
90 // Return the upper bound of the scale
91 double upperBound() const;
92
93 // Set the step size for scale calculation
94 void setScaleStepSize(double stepSize);
95
96 // Return the current step size hint
97 double scaleStepSize() const;
98
99 // Set the maximum number of major tick intervals
100 void setScaleMaxMajor(int ticks);
101
102 // Return the maximum number of minor tick intervals
103 int scaleMaxMinor() const;
104
105 // Set the maximum number of minor tick intervals
106 void setScaleMaxMinor(int ticks);
107
108 // Return the maximum number of major tick intervals
109 int scaleMaxMajor() const;
110
111 // Set the scale engine
112 void setScaleEngine(QwtScaleEngine*);
113
114 // Return the scale engine (const version)
115 const QwtScaleEngine* scaleEngine() const;
116
117 // Return the scale engine (non-const version)
118 QwtScaleEngine* scaleEngine();
119
120 // Transform a scale value to widget coordinates
121 int transform(double) const;
122
123 // Transform a widget coordinate to scale value
124 double invTransform(int) const;
125
126 // Return true if scale is inverted
127 bool isInverted() const;
128
129 // Return the minimum boundary value
130 double minimum() const;
131
132 // Return the maximum boundary value
133 double maximum() const;
134
135 // Return the scale map
136 const QwtScaleMap& scaleMap() const;
137
138protected:
140 virtual void changeEvent(QEvent*) override;
141
143 void rescale(double lowerBound, double upperBound, double stepSize);
144
146 void setAbstractScaleDraw(QwtAbstractScaleDraw*);
147
149 const QwtAbstractScaleDraw* abstractScaleDraw() const;
150
152 QwtAbstractScaleDraw* abstractScaleDraw();
153
155 void updateScaleDraw();
156
158 virtual void scaleChange();
159
160private:
161 QWT_DECLARE_PRIVATE(QwtAbstractScale)
162};
163
164#endif
An abstract base class for drawing scales
Definition qwt_abstract_scale_draw.h:47
An abstract base class for widgets having a scale
Definition qwt_abstract_scale.h:51
A class representing an interval
Definition qwt_interval.h:39
A class representing a scale division
Definition qwt_scale_div.h:47
Base class for scale engines
Definition qwt_scale_engine.h:62
A scale map
Definition qwt_scale_map.h:44