QWT 7.0.1
Loading...
Searching...
No Matches
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
63class QWT_EXPORT QwtThermo : public QwtAbstractScale
64{
65 Q_OBJECT
66
67 Q_ENUMS( ScalePosition )
68 Q_ENUMS( OriginMode )
69
70 Q_PROPERTY( Qt::Orientation orientation
71 READ orientation WRITE setOrientation )
72 Q_PROPERTY( ScalePosition scalePosition
73 READ scalePosition WRITE setScalePosition )
74 Q_PROPERTY( OriginMode originMode READ originMode WRITE setOriginMode )
75
76 Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled )
77 Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel )
78 Q_PROPERTY( double origin READ origin WRITE setOrigin )
79 Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
80 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
81 Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth )
82 Q_PROPERTY( double value READ value WRITE setValue USER true )
83
84 public:
85
91 {
94
97
99 TrailingScale
100 };
101
109 {
112
115
117 OriginCustom
118 };
119
120 explicit QwtThermo( QWidget* parent = NULL );
121 virtual ~QwtThermo();
122
123 void setOrientation( Qt::Orientation );
124 Qt::Orientation orientation() const;
125
126 void setScalePosition( ScalePosition );
127 ScalePosition scalePosition() const;
128
129 void setSpacing( int );
130 int spacing() const;
131
132 void setBorderWidth( int );
133 int borderWidth() const;
134
135 void setOriginMode( OriginMode );
136 OriginMode originMode() const;
137
138 void setOrigin( double );
139 double origin() const;
140
141 void setFillBrush( const QBrush& );
142 QBrush fillBrush() const;
143
144 void setAlarmBrush( const QBrush& );
145 QBrush alarmBrush() const;
146
147 void setAlarmLevel( double );
148 double alarmLevel() const;
149
150 void setAlarmEnabled( bool );
151 bool alarmEnabled() const;
152
153 void setColorMap( QwtColorMap* );
154 QwtColorMap* colorMap();
155 const QwtColorMap* colorMap() const;
156
157 void setPipeWidth( int );
158 int pipeWidth() const;
159
160 void setRangeFlags( QwtInterval::BorderFlags );
161 QwtInterval::BorderFlags rangeFlags() const;
162
163 double value() const;
164
165 virtual QSize sizeHint() const QWT_OVERRIDE;
166 virtual QSize minimumSizeHint() const QWT_OVERRIDE;
167
168 void setScaleDraw( QwtScaleDraw* );
169 const QwtScaleDraw* scaleDraw() const;
170
171 public Q_SLOTS:
172 virtual void setValue( double );
173
174 protected:
175 virtual void drawLiquid( QPainter*, const QRect& ) const;
176 virtual void scaleChange() QWT_OVERRIDE;
177
178 virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
179 virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
180 virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
181
182 QwtScaleDraw* scaleDraw();
183
184 QRect pipeRect() const;
185 QRect fillRect( const QRect& ) const;
186 QRect alarmRect( const QRect& ) const;
187
188 private:
189 void layoutThermo( bool );
190
191 class PrivateData;
192 PrivateData* m_data;
193};
194
195#endif
An abstract base class for widgets having a scale.
Definition qwt_abstract_scale.h:54
QwtColorMap is used to map values into colors.
Definition qwt_color_map.h:56
A class for drawing scales.
Definition qwt_scale_draw.h:53
The Thermometer Widget.
Definition qwt_thermo.h:64
ScalePosition
Position of the scale.
Definition qwt_thermo.h:91
@ NoScale
The slider has no scale.
Definition qwt_thermo.h:93
@ LeadingScale
The scale is right of a vertical or below of a horizontal slider.
Definition qwt_thermo.h:96
OriginMode
Origin mode.
Definition qwt_thermo.h:109
@ OriginMaximum
The origin is the maximum of the scale.
Definition qwt_thermo.h:114
@ OriginMinimum
The origin is the minimum of the scale.
Definition qwt_thermo.h:111