QWT API (中文) 7.3.0
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
54class QWT_EXPORT QwtThermo : public QwtAbstractScale
55{
56 Q_OBJECT
57
58 Q_ENUMS(ScalePosition)
59 Q_ENUMS(OriginMode)
60
61 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
62 Q_PROPERTY(ScalePosition scalePosition READ scalePosition WRITE setScalePosition)
63 Q_PROPERTY(OriginMode originMode READ originMode WRITE setOriginMode)
64
65 Q_PROPERTY(bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled)
66 Q_PROPERTY(double alarmLevel READ alarmLevel WRITE setAlarmLevel)
67 Q_PROPERTY(double origin READ origin WRITE setOrigin)
68 Q_PROPERTY(int spacing READ spacing WRITE setSpacing)
69 Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth)
70 Q_PROPERTY(int pipeWidth READ pipeWidth WRITE setPipeWidth)
71 Q_PROPERTY(bool flatStyle READ flatStyle WRITE setFlatStyle)
72 Q_PROPERTY(double value READ value WRITE setValue USER true)
73
74public:
80 {
83
86
88 TrailingScale
89 };
90
96 {
99
102
104 OriginCustom
105 };
106
107 // Constructor
108 explicit QwtThermo(QWidget* parent = nullptr);
109 // Destructor
110 ~QwtThermo() override;
111
112 // Set the orientation
113 void setOrientation(Qt::Orientation);
114 // Return the orientation
115 Qt::Orientation orientation() const;
116
117 // Set the scale position
118 void setScalePosition(ScalePosition);
119 // Return the scale position
120 ScalePosition scalePosition() const;
121
122 // Set the spacing
123 void setSpacing(int);
124 // Return the spacing
125 int spacing() const;
126
127 // Set the border width
128 void setBorderWidth(int);
129 // Return the border width
130 int borderWidth() const;
131
132 // Set the origin mode
133 void setOriginMode(OriginMode);
134 // Return the origin mode
135 OriginMode originMode() const;
136
137 // Set the origin
138 void setOrigin(double);
139 // Return the origin
140 double origin() const;
141
142 // Set the fill brush
143 void setFillBrush(const QBrush&);
144 // Return the fill brush
145 QBrush fillBrush() const;
146
147 // Set the alarm brush
148 void setAlarmBrush(const QBrush&);
149 // Return the alarm brush
150 QBrush alarmBrush() const;
151
152 // Set the alarm level
153 void setAlarmLevel(double);
154 // Return the alarm level
155 double alarmLevel() const;
156
157 // Set whether alarm is enabled
158 void setAlarmEnabled(bool);
159 // Return whether alarm is enabled
160 bool alarmEnabled() const;
161
162 // Set the color map
163 void setColorMap(QwtColorMap*);
164 // Return the color map
165 QwtColorMap* colorMap();
166 // Return the color map (const version)
167 const QwtColorMap* colorMap() const;
168
169 // Set the pipe width
170 void setPipeWidth(int);
171 // Return the pipe width
172 int pipeWidth() const;
173
174 // Set flat style
175 void setFlatStyle(bool);
176 // Return flat style
177 bool flatStyle() const;
178
179 // Set the range flags
180 void setRangeFlags(QwtInterval::BorderFlags);
181 // Return the range flags
182 QwtInterval::BorderFlags rangeFlags() const;
183
184 // Return the current value
185 double value() const;
186
187 // Return the size hint
188 virtual QSize sizeHint() const override;
189 // Return the minimum size hint
190 virtual QSize minimumSizeHint() const override;
191
192 // Set the scale draw
193 void setScaleDraw(QwtScaleDraw*);
194 // Return the scale draw
195 const QwtScaleDraw* scaleDraw() const;
196
197public Q_SLOTS:
198 // Set the current value
199 virtual void setValue(double);
200
201protected:
203 virtual void drawLiquid(QPainter*, const QRect&) const;
205 virtual void scaleChange() override;
206
208 virtual void paintEvent(QPaintEvent*) override;
210 virtual void resizeEvent(QResizeEvent*) override;
212 virtual void changeEvent(QEvent*) override;
213
215 QwtScaleDraw* scaleDraw();
216
218 QRect pipeRect() const;
220 QRect fillRect(const QRect&) const;
222 QRect alarmRect(const QRect&) const;
223
224private:
226 void layoutThermo(bool);
227
228 QWT_DECLARE_PRIVATE(QwtThermo)
229};
230
231#endif
An abstract base class for widgets having a scale
Definition qwt_abstract_scale.h:51
virtual void scaleChange()
Notify about scale changes (English only)
Definition qwt_abstract_scale.cpp:423
virtual void changeEvent(QEvent *) override
Handle change events (English only)
Definition qwt_abstract_scale.cpp:454
QwtColorMap is used to map values into colors.
Definition qwt_colormap.h:33
A class for drawing scales
Definition qwt_scale_draw.h:52
The Thermometer Widget
Definition qwt_thermo.h:55
ScalePosition
Position of the scale
Definition qwt_thermo.h:80
@ NoScale
The slider has no scale
Definition qwt_thermo.h:82
@ LeadingScale
The scale is right of a vertical or below of a horizontal slider
Definition qwt_thermo.h:85
OriginMode
Origin mode. This property specifies where the beginning of the liquid is placed.
Definition qwt_thermo.h:96
@ OriginMaximum
The origin is the maximum of the scale
Definition qwt_thermo.h:101
@ OriginMinimum
The origin is the minimum of the scale
Definition qwt_thermo.h:98