Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

qwt_thermo.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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
10 #ifndef QWT_THERMO_H
11 #define QWT_THERMO_H
12
13 #include "qwt_global.h"
14 #include "qwt_abstract_scale.h"
15 #include "qwt_interval.h"
16 #include <qwidget.h>
17
18 class QwtScaleDraw;
19 class QwtColorMap;
20
83 class QWT_EXPORT QwtThermo: public QWidget, public QwtAbstractScale
84 {
85 Q_OBJECT
86
87 Q_ENUMS( ScalePos )
88
89 Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled )
90 Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel )
91 Q_PROPERTY( ScalePos scalePosition READ scalePosition
92 WRITE setScalePosition )
93 Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
94 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
95 Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue )
96 Q_PROPERTY( double minValue READ minValue WRITE setMinValue )
97 Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth )
98 Q_PROPERTY( double value READ value WRITE setValue )
99
100 public:
110 enum ScalePos
111 {
113 NoScale,
114
116 LeftScale,
117
119 RightScale,
120
122 TopScale,
123
125 BottomScale
126 };
127
128 explicit QwtThermo( QWidget *parent = NULL );
129 virtual ~QwtThermo();
130
131 void setOrientation( Qt::Orientation, ScalePos );
132
133 void setScalePosition( ScalePos s );
134 ScalePos scalePosition() const;
135
136 void setSpacing( int );
137 int spacing() const;
138
139 void setBorderWidth( int w );
140 int borderWidth() const;
141
142 void setFillBrush( const QBrush &b );
143 const QBrush &fillBrush() const;
144
145 void setAlarmBrush( const QBrush &b );
146 const QBrush &alarmBrush() const;
147
148 void setAlarmLevel( double v );
149 double alarmLevel() const;
150
151 void setAlarmEnabled( bool tf );
152 bool alarmEnabled() const;
153
154 void setColorMap( QwtColorMap * );
155 QwtColorMap *colorMap();
156 const QwtColorMap *colorMap() const;
157
158 void setPipeWidth( int w );
159 int pipeWidth() const;
160
161 void setRangeFlags( QwtInterval::BorderFlags );
162 QwtInterval::BorderFlags rangeFlags() const;
163
164 void setMaxValue( double v );
165 double maxValue() const;
166
167 void setMinValue( double v );
168 double minValue() const;
169
170 double value() const;
171
172 void setRange( double vmin, double vmax, bool lg = false );
173
174 virtual QSize sizeHint() const;
175 virtual QSize minimumSizeHint() const;
176
177 void setScaleDraw( QwtScaleDraw * );
178 const QwtScaleDraw *scaleDraw() const;
179
180 public Q_SLOTS:
181 virtual void setValue( double val );
182
183 protected:
184 virtual void drawLiquid( QPainter *, const QRect & ) const;
185 virtual void scaleChange();
186
187 virtual void paintEvent( QPaintEvent * );
188 virtual void resizeEvent( QResizeEvent * );
189 virtual void changeEvent( QEvent * );
190
191 QwtScaleDraw *scaleDraw();
192
193 QRect pipeRect() const;
194
195 private:
196 void layoutThermo( bool );
197
198 class PrivateData;
199 PrivateData *d_data;
200 };
201
202 #endif