QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_thermo.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_THERMO_H
28#define QWT_THERMO_H
29
30#include "qwt_global.h"
31#include "qwt_abstract_scale.h"
32#include "qwt_interval.h"
33
34class QwtScaleDraw;
35class QwtColorMap;
36
72class QWT_EXPORT QwtThermo : public QwtAbstractScale
73{
74 Q_OBJECT
75
76 Q_ENUMS( ScalePosition )
77 Q_ENUMS( OriginMode )
78
79 Q_PROPERTY( Qt::Orientation orientation
80 READ orientation WRITE setOrientation )
81 Q_PROPERTY( ScalePosition scalePosition
82 READ scalePosition WRITE setScalePosition )
83 Q_PROPERTY( OriginMode originMode READ originMode WRITE setOriginMode )
84
85 Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled )
86 Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel )
87 Q_PROPERTY( double origin READ origin WRITE setOrigin )
88 Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
89 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
90 Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth )
91 Q_PROPERTY( double value READ value WRITE setValue USER true )
92
93 public:
94
106 {
109
112
114 TrailingScale
115 };
116
128 {
131
134
136 OriginCustom
137 };
138
139 // Constructor
140 explicit QwtThermo( QWidget* parent = nullptr );
141 // Destructor
142 virtual ~QwtThermo();
143
144 // Set the orientation
145 void setOrientation( Qt::Orientation );
146 // Return the orientation
147 Qt::Orientation orientation() const;
148
149 // Set the scale position
150 void setScalePosition( ScalePosition );
151 // Return the scale position
152 ScalePosition scalePosition() const;
153
154 // Set the spacing
155 void setSpacing( int );
156 // Return the spacing
157 int spacing() const;
158
159 // Set the border width
160 void setBorderWidth( int );
161 // Return the border width
162 int borderWidth() const;
163
164 // Set the origin mode
165 void setOriginMode( OriginMode );
166 // Return the origin mode
167 OriginMode originMode() const;
168
169 // Set the origin
170 void setOrigin( double );
171 // Return the origin
172 double origin() const;
173
174 // Set the fill brush
175 void setFillBrush( const QBrush& );
176 // Return the fill brush
177 QBrush fillBrush() const;
178
179 // Set the alarm brush
180 void setAlarmBrush( const QBrush& );
181 // Return the alarm brush
182 QBrush alarmBrush() const;
183
184 // Set the alarm level
185 void setAlarmLevel( double );
186 // Return the alarm level
187 double alarmLevel() const;
188
189 // Set whether alarm is enabled
190 void setAlarmEnabled( bool );
191 // Return whether alarm is enabled
192 bool alarmEnabled() const;
193
194 // Set the color map
195 void setColorMap( QwtColorMap* );
196 // Return the color map
197 QwtColorMap* colorMap();
198 // Return the color map (const version)
199 const QwtColorMap* colorMap() const;
200
201 // Set the pipe width
202 void setPipeWidth( int );
203 // Return the pipe width
204 int pipeWidth() const;
205
206 // Set the range flags
207 void setRangeFlags( QwtInterval::BorderFlags );
208 // Return the range flags
209 QwtInterval::BorderFlags rangeFlags() const;
210
211 // Return the current value
212 double value() const;
213
214 // Return the size hint
215 virtual QSize sizeHint() const override;
216 // Return the minimum size hint
217 virtual QSize minimumSizeHint() const override;
218
219 // Set the scale draw
220 void setScaleDraw( QwtScaleDraw* );
221 // Return the scale draw
222 const QwtScaleDraw* scaleDraw() const;
223
224 public Q_SLOTS:
225 // Set the current value
226 virtual void setValue( double );
227
228 protected:
230 virtual void drawLiquid( QPainter*, const QRect& ) const;
232 virtual void scaleChange() override;
233
235 virtual void paintEvent( QPaintEvent* ) override;
237 virtual void resizeEvent( QResizeEvent* ) override;
239 virtual void changeEvent( QEvent* ) override;
240
242 QwtScaleDraw* scaleDraw();
243
245 QRect pipeRect() const;
247 QRect fillRect( const QRect& ) const;
249 QRect alarmRect( const QRect& ) const;
250
251 private:
253 void layoutThermo( bool );
254
255 class PrivateData;
256 PrivateData* m_data;
257};
258
259#endif
具有刻度的控件的抽象基类
Definition qwt_abstract_scale.h:62
virtual void scaleChange()
Notify about scale changes (English only)
Definition qwt_abstract_scale.cpp:620
virtual void changeEvent(QEvent *) override
Handle change events (English only)
Definition qwt_abstract_scale.cpp:670
QwtColorMap 用于将数值映射为颜色。
Definition qwt_color_map.h:62
用于绘制刻度的类
Definition qwt_scale_draw.h:62
温度计控件
Definition qwt_thermo.h:73
ScalePosition
刻度的位置
Definition qwt_thermo.h:106
@ NoScale
The slider has no scale
Definition qwt_thermo.h:108
@ LeadingScale
The scale is right of a vertical or below of a horizontal slider
Definition qwt_thermo.h:111
OriginMode
原点模式。此属性指定液体的起始位置。
Definition qwt_thermo.h:128
@ OriginMaximum
The origin is the maximum of the scale
Definition qwt_thermo.h:133
@ OriginMinimum
The origin is the minimum of the scale
Definition qwt_thermo.h:130