1
.TH "QwtThermo" 3 "22 Mar 2009" "Qwt User's Guide" \" -*- nroff -*-
5
QwtThermo \- The Thermometer Widget.
11
\fC#include <qwt_thermo.h>\fP
13
Inherits \fBQwtAbstractScale\fP.
19
.RI "enum \fBScalePos\fP { \fBNoScale\fP, \fBLeftScale\fP, \fBRightScale\fP, \fBTopScale\fP, \fBBottomScale\fP }"
25
.RI "void \fBsetValue\fP (double val)"
28
.SS "Public Member Functions"
32
.RI "\fBQwtThermo\fP (QWidget *parent=NULL)"
35
.RI "virtual \fB~QwtThermo\fP ()"
38
.RI "void \fBsetOrientation\fP (Qt::Orientation o, ScalePos s)"
41
.RI "void \fBsetScalePosition\fP (ScalePos s)"
44
.RI "ScalePos \fBscalePosition\fP () const "
47
.RI "void \fBsetBorderWidth\fP (int w)"
50
.RI "int \fBborderWidth\fP () const "
53
.RI "void \fBsetFillBrush\fP (const QBrush &b)"
56
.RI "const QBrush & \fBfillBrush\fP () const "
59
.RI "void \fBsetFillColor\fP (const QColor &c)"
62
.RI "const QColor & \fBfillColor\fP () const "
65
.RI "void \fBsetAlarmBrush\fP (const QBrush &b)"
68
.RI "const QBrush & \fBalarmBrush\fP () const "
71
.RI "void \fBsetAlarmColor\fP (const QColor &c)"
74
.RI "const QColor & \fBalarmColor\fP () const "
77
.RI "void \fBsetAlarmLevel\fP (double v)"
80
.RI "double \fBalarmLevel\fP () const "
83
.RI "void \fBsetAlarmEnabled\fP (bool tf)"
86
.RI "bool \fBalarmEnabled\fP () const "
89
.RI "void \fBsetPipeWidth\fP (int w)"
92
.RI "int \fBpipeWidth\fP () const "
95
.RI "void \fBsetMaxValue\fP (double v)"
98
.RI "double \fBmaxValue\fP () const "
101
.RI "void \fBsetMinValue\fP (double v)"
104
.RI "double \fBminValue\fP () const "
107
.RI "double \fBvalue\fP () const "
110
.RI "void \fBsetRange\fP (double vmin, double vmax, bool lg=false)"
113
.RI "void \fBsetMargin\fP (int m)"
116
.RI "virtual QSize \fBsizeHint\fP () const "
119
.RI "virtual QSize \fBminimumSizeHint\fP () const "
122
.RI "void \fBsetScaleDraw\fP (\fBQwtScaleDraw\fP *)"
125
.RI "const \fBQwtScaleDraw\fP * \fBscaleDraw\fP () const "
128
.SS "Protected Member Functions"
132
.RI "void \fBdraw\fP (QPainter *p, const QRect &update_rect)"
135
.RI "void \fBdrawThermo\fP (QPainter *p)"
138
.RI "void \fBlayoutThermo\fP (bool update=true)"
141
.RI "virtual void \fBscaleChange\fP ()"
144
.RI "virtual void \fBfontChange\fP (const QFont &oldFont)"
147
.RI "virtual void \fBpaintEvent\fP (QPaintEvent *e)"
150
.RI "virtual void \fBresizeEvent\fP (QResizeEvent *e)"
153
.RI "\fBQwtScaleDraw\fP * \fBscaleDraw\fP ()"
156
.SH "Detailed Description"
158
The Thermometer Widget.
160
\fBQwtThermo\fP is a widget which displays a value in an interval. It supports:
162
a horizontal or vertical layout;
172
By default, the scale and range run over the same interval of values. \fBQwtAbstractScale::setScale()\fP changes the interval of the scale and allows easy conversion between physical units.
174
The example shows how to make the scale indicate in degrees Fahrenheit and to set the value in degrees Kelvin:
177
#include <qapplication.h>
178
#include <qwt_thermo.h>
180
double Kelvin2Fahrenheit(double kelvin)
182
// see http://en.wikipedia.org/wiki/Kelvin
183
return 1.8*kelvin - 459.67;
186
int main(int argc, char **argv)
188
const double minKelvin = 0.0;
189
const double maxKelvin = 500.0;
191
QApplication a(argc, argv);
193
t.setRange(minKelvin, maxKelvin);
194
t.setScale(Kelvin2Fahrenheit(minKelvin), Kelvin2Fahrenheit(maxKelvin));
195
// set the value in Kelvin but the scale displays in Fahrenheit
196
// 273.15 Kelvin = 0 Celsius = 32 Fahrenheit
206
.SH "Constructor & Destructor Documentation"
208
.SS "QwtThermo::QwtThermo (QWidget * parent = \fCNULL\fP)\fC [explicit]\fP"
214
\fIparent\fP Parent widget
218
.SS "QwtThermo::~QwtThermo ()\fC [virtual]\fP"
222
.SH "Member Function Documentation"
224
.SS "const QBrush & QwtThermo::alarmBrush () const"
226
Return the liquid brush above the alarm threshold.
230
\fBsetAlarmBrush()\fP
234
.SS "const QColor & QwtThermo::alarmColor () const"
236
Return the liquid color above the alarm threshold.
238
.SS "bool QwtThermo::alarmEnabled () const"
240
Return if the alarm threshold is enabled or disabled.
242
.SS "double QwtThermo::alarmLevel () const"
244
Return the alarm threshold.
248
\fBsetAlarmLevel()\fP
252
.SS "int QwtThermo::borderWidth () const"
254
Return the border width of the thermometer pipe.
258
\fBsetBorderWidth()\fP
262
.SS "void QwtThermo::draw (QPainter * painter, const QRect & rect)\fC [protected]\fP"
264
Draw the whole \fBQwtThermo\fP.
268
\fIpainter\fP Painter
270
\fIrect\fP Update rectangle
274
.SS "void QwtThermo::drawThermo (QPainter * painter)\fC [protected]\fP"
276
Redraw the liquid in thermometer pipe.
280
\fIpainter\fP Painter
284
.SS "const QBrush & QwtThermo::fillBrush () const"
286
Return the liquid brush.
294
.SS "const QColor & QwtThermo::fillColor () const"
296
Return the liquid color.
304
.SS "void QwtThermo::fontChange (const QFont & oldFont)\fC [protected, virtual]\fP"
306
Notify a font change.
308
.SS "void QwtThermo::layoutThermo (bool update_geometry = \fCtrue\fP)\fC [protected]\fP"
310
Recalculate the \fBQwtThermo\fP geometry and layout based on the QwtThermo::rect() and the fonts.
314
\fIupdate_geometry\fP notify the layout system and call update to redraw the scale
318
.SS "double QwtThermo::maxValue () const"
320
Return the maximum value.
322
.SS "QSize QwtThermo::minimumSizeHint () const\fC [virtual]\fP"
324
Return a minimum size hint.
328
The return value depends on the font and the scale.
337
.SS "double QwtThermo::minValue () const"
339
Return the minimum value.
341
.SS "void QwtThermo::paintEvent (QPaintEvent * event)\fC [protected, virtual]\fP"
343
Qt paint event. event Paint event
344
.SS "int QwtThermo::pipeWidth () const"
346
Return the width of the pipe.
354
.SS "void QwtThermo::resizeEvent (QResizeEvent * e)\fC [protected, virtual]\fP"
356
Qt resize event handler.
358
.SS "void QwtThermo::scaleChange ()\fC [protected, virtual]\fP"
360
Notify a scale change.
362
Reimplemented from \fBQwtAbstractScale\fP.
363
.SS "\fBQwtScaleDraw\fP * QwtThermo::scaleDraw ()\fC [protected]\fP"
367
the scale draw of the thermo
376
.SS "const \fBQwtScaleDraw\fP * QwtThermo::scaleDraw () const"
380
the scale draw of the thermo
389
.SS "QwtThermo::ScalePos QwtThermo::scalePosition () const"
391
Return the scale position.
395
\fBsetScalePosition()\fP
399
.SS "void QwtThermo::setAlarmBrush (const QBrush & brush)"
401
Specify the liquid brush above the alarm threshold.
405
\fIbrush\fP New brush. The default is solid white.
414
.SS "void QwtThermo::setAlarmColor (const QColor & c)"
416
Specify the liquid color above the alarm threshold.
420
\fIc\fP New color. The default is white.
424
.SS "void QwtThermo::setAlarmEnabled (bool tf)"
426
Enable or disable the alarm threshold.
430
\fItf\fP true (disabled) or false (enabled)
434
.SS "void QwtThermo::setAlarmLevel (double level)"
436
Specify the alarm threshold.
440
\fIlevel\fP Alarm threshold
449
.SS "void QwtThermo::setBorderWidth (int width)"
451
Set the border width of the pipe.
455
\fIwidth\fP Border width
464
.SS "void QwtThermo::setFillBrush (const QBrush & brush)"
466
Change the brush of the liquid.
470
\fIbrush\fP New brush. The default brush is solid black.
479
.SS "void QwtThermo::setFillColor (const QColor & c)"
481
Change the color of the liquid.
485
\fIc\fP New color. The default color is black.
494
.SS "void QwtThermo::setMargin (int m)"
496
Specify the distance between the pipe's endpoints and the widget's border.
498
The margin is used to leave some space for the scale labels. If a large font is used, it is advisable to adjust the margins.
502
\fIm\fP New Margin. The default values are 10 for horizontal orientation and 20 for vertical orientation.
507
The margin has no effect if the scale is disabled.
509
This function is a NOOP because margins are determined automatically.
513
.SS "void QwtThermo::setMaxValue (double max)"
515
Set the maximum value.
519
\fImax\fP Maximum value
524
\fBmaxValue()\fP, \fBsetMinValue()\fP
528
.SS "void QwtThermo::setMinValue (double min)"
530
Set the minimum value.
534
\fImin\fP Minimum value
539
\fBminValue()\fP, \fBsetMaxValue()\fP
543
.SS "void QwtThermo::setOrientation (Qt::Orientation o, ScalePos s)"
545
Set the thermometer orientation and the scale position.
547
The scale position NoScale disables the scale.
551
\fIo\fP orientation. Possible values are Qt::Horizontal and Qt::Vertical. The default value is Qt::Vertical.
553
\fIs\fP Position of the scale. The default value is NoScale.
556
A valid combination of scale position and orientation is enforced:
558
a horizontal thermometer can have the scale positions TopScale, BottomScale or NoScale;
560
a vertical thermometer can have the scale positions LeftScale, RightScale or NoScale;
562
an invalid scale position will default to NoScale.
567
\fBsetScalePosition()\fP
571
.SS "void QwtThermo::setPipeWidth (int width)"
573
Change the width of the pipe.
577
\fIwidth\fP Width of the pipe
586
.SS "void QwtThermo::setRange (double vmin, double vmax, bool logarithmic = \fCfalse\fP)"
592
\fIvmin\fP value corresponding lower or left end of the thermometer
594
\fIvmax\fP value corresponding to the upper or right end of the thermometer
596
\fIlogarithmic\fP logarithmic mapping, true or false
600
.SS "void QwtThermo::setScaleDraw (\fBQwtScaleDraw\fP * scaleDraw)"
604
For changing the labels of the scales, it is necessary to derive from \fBQwtScaleDraw\fP and overload \fBQwtScaleDraw::label()\fP.
608
\fIscaleDraw\fP ScaleDraw object, that has to be created with new and will be deleted in ~QwtThermo or the next call of \fBsetScaleDraw()\fP.
612
.SS "void QwtThermo::setScalePosition (ScalePos scalePos)"
614
Change the scale position (and thermometer orientation).
618
\fIscalePos\fP Position of the scale.
621
A valid combination of scale position and orientation is enforced:
623
if the new scale position is LeftScale or RightScale, the scale orientation will become Qt::Vertical;
625
if the new scale position is BottomScale or TopScale, the scale orientation will become Qt::Horizontal;
627
if the new scale position is NoScale, the scale orientation will not change.
632
\fBsetOrientation()\fP, \fBscalePosition()\fP
636
.SS "void QwtThermo::setValue (double value)\fC [slot]\fP"
638
Set the current value.
642
\fIvalue\fP New Value
651
.SS "QSize QwtThermo::sizeHint () const\fC [virtual]\fP"
655
the minimum size hint
660
\fBminimumSizeHint()\fP
664
.SS "double QwtThermo::value () const"
672
Generated automatically by Doxygen for Qwt User's Guide from the source code.