Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

QwtThermo Class Reference

The Thermometer Widget. More...

#include <qwt_thermo.h>

Inheritance diagram for QwtThermo:

QwtScaleIf List of all members.

Public Types

enum  ScalePos {
  None, Left, Right, Top,
  Bottom
}

Public Slots

void setValue (double val)

Public Member Functions

 QwtThermo (QWidget *parent=0, const char *name=0)
virtual ~QwtThermo ()
void setOrientation (Qt::Orientation o, ScalePos s)
void setBorderWidth (int w)
void setFillColor (const QColor &c)
void setAlarmColor (const QColor &c)
void setAlarmLevel (double v)
void setAlarmEnabled (int tf)
void setPipeWidth (int w)
void setRange (double vmin, double vmax)
void setMargin (int m)
double maxValue ()
double minValue ()
double value ()
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const
virtual QSizePolicy sizePolicy () const

Protected Member Functions

void draw (QPainter *p, const QRect &update_rect)
void drawThermo (QPainter *p)
void layoutThermo (bool update=TRUE)
virtual void scaleChange ()
virtual void fontChange (const QFont &oldFont)
virtual void paintEvent (QPaintEvent *e)
virtual void resizeEvent (QResizeEvent *e)

Private Member Functions

void init ()

Private Attributes

QwtDiMap d_map
QRect d_thermoRect
QColor d_fillColor
QColor d_alarmColor
Qt::Orientation d_orient
ScalePos d_scalePos
int d_borderWidth
int d_scaleDist
int d_thermoWidth
double d_minValue
double d_maxValue
double d_value
double d_alarmLevel
int d_alarmEnabled

Detailed Description

The Thermometer Widget.

Definition at line 24 of file qwt_thermo.h.


Member Enumeration Documentation

enum QwtThermo::ScalePos
 

Position of the scale

See also:
QwtThermo;;QwtThermo
Enumeration values:
None 
Left 
Right 
Top 
Bottom 

Definition at line 33 of file qwt_thermo.h.


Constructor & Destructor Documentation

QwtThermo::QwtThermo QWidget *  parent = 0,
const char *  name = 0
 

Constructor.

Definition at line 19 of file qwt_thermo.cpp.

References init().

QwtThermo::~QwtThermo  )  [virtual]
 

Destructor.

Definition at line 26 of file qwt_thermo.cpp.


Member Function Documentation

void QwtThermo::draw QPainter *  p,
const QRect &  update_rect
[protected]
 

redraw the thermo

Definition at line 78 of file qwt_thermo.cpp.

References d_borderWidth, QwtScaleIf::d_scaleDraw, d_scalePos, d_thermoRect, QwtScaleDraw::draw(), drawThermo(), and None.

Referenced by paintEvent().

void QwtThermo::drawThermo QPainter *  p  )  [protected]
 

Redraw the thermometer.

Definition at line 252 of file qwt_thermo.cpp.

References d_alarmColor, d_alarmEnabled, d_alarmLevel, d_fillColor, d_map, d_maxValue, d_minValue, d_orient, d_thermoRect, d_value, and QwtDiMap::limTransform().

Referenced by draw().

void QwtThermo::fontChange const QFont &  oldFont  )  [protected, virtual]
 

notify changed font

Definition at line 238 of file qwt_thermo.cpp.

References layoutThermo().

void QwtThermo::init  )  [private]
 

initialize data members

Definition at line 31 of file qwt_thermo.cpp.

References d_alarmColor, d_alarmEnabled, d_alarmLevel, d_borderWidth, d_fillColor, d_map, QwtScaleIf::d_maxMajor, QwtScaleIf::d_maxMinor, d_maxValue, d_minValue, d_orient, d_scaleDist, QwtScaleIf::d_scaleDraw, d_scalePos, d_thermoWidth, d_value, Left, QwtDiMap::setDblRange(), and QwtScaleDraw::setScale().

Referenced by QwtThermo().

void QwtThermo::layoutThermo bool  update = TRUE  )  [protected]
 

Recalculate the thermo's geometry and layout based on.

Definition at line 105 of file qwt_thermo.cpp.

References QwtScaleDraw::Bottom, Bottom, d_borderWidth, d_map, d_orient, d_scaleDist, QwtScaleIf::d_scaleDraw, d_scalePos, d_thermoRect, d_thermoWidth, QwtScaleDraw::Left, Left, QwtScaleDraw::minBorderDist(), None, QwtScaleDraw::Right, Right, QwtScaleDraw::setGeometry(), QwtDiMap::setIntRange(), QwtScaleDraw::Top, and Top.

Referenced by fontChange(), resizeEvent(), scaleChange(), setBorderWidth(), setOrientation(), setPipeWidth(), and setRange().

double QwtThermo::maxValue  )  [inline]
 

Returns:
max value

Definition at line 48 of file qwt_thermo.h.

QSize QwtThermo::minimumSizeHint  )  const [virtual]
 

Return a minimum size hint.

Warning:
The return value depends on the font and the scale.
See also:
QwtThermo::sizeHint

Definition at line 546 of file qwt_thermo.cpp.

References d_borderWidth, d_orient, d_scaleDist, QwtScaleIf::d_scaleDraw, d_scalePos, d_thermoWidth, QwtScaleDraw::minHeight(), QwtScaleDraw::minWidth(), and None.

Referenced by sizeHint().

double QwtThermo::minValue  )  [inline]
 

Returns:
min value

Definition at line 50 of file qwt_thermo.h.

void QwtThermo::paintEvent QPaintEvent *  e  )  [protected, virtual]
 

Qt paint event.

Definition at line 66 of file qwt_thermo.cpp.

References draw(), and QwtPaintBuffer::painter().

void QwtThermo::resizeEvent QResizeEvent *  e  )  [protected, virtual]
 

Qt resize event handler.

Definition at line 96 of file qwt_thermo.cpp.

References layoutThermo().

void QwtThermo::scaleChange  )  [protected, virtual]
 

notify changed scale

Implements QwtScaleIf.

Definition at line 245 of file qwt_thermo.cpp.

References layoutThermo().

Referenced by setRange().

void QwtThermo::setAlarmColor const QColor &  c  ) 
 

Specify liquid color above the alarm threshold.

Parameters:
c New color. The default is white.

Definition at line 456 of file qwt_thermo.cpp.

References d_alarmColor.

void QwtThermo::setAlarmEnabled int  tf  ) 
 

Enable or disable alarm threshold.

Parameters:
tf ZERO (disabled) or non-zero (enabled)

Definition at line 504 of file qwt_thermo.cpp.

References d_alarmEnabled.

void QwtThermo::setAlarmLevel double  v  ) 
 

Specify the alarm threshold.

Definition at line 463 of file qwt_thermo.cpp.

References d_alarmEnabled, and d_alarmLevel.

void QwtThermo::setBorderWidth int  w  ) 
 

Set the border width of the pipe.

Definition at line 410 of file qwt_thermo.cpp.

References d_borderWidth, d_thermoRect, layoutThermo(), and qwtMin.

void QwtThermo::setFillColor const QColor &  c  ) 
 

Change the color of the liquid.

Parameters:
c New color. The default color is black.

Definition at line 446 of file qwt_thermo.cpp.

References d_fillColor.

void QwtThermo::setMargin int  m  ) 
 

Specify the distance between the pipe's endpoints and the widget's border.

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.

Parameters:
m New Margin. The default values are 10 for horizontal orientation and 20 for vertical orientation.
Warning:
The margin has no effect if the scale is disabled.

This function is a NOOP because margins are determined automatically.

Definition at line 495 of file qwt_thermo.cpp.

void QwtThermo::setOrientation Qt::Orientation  o,
ScalePos  s
 

Change the thermometer's orientation.

The scale position None disables the scale.

Parameters:
o orientation. Possible values are Qt::Horizontal and Qt::Vertical. The default value is Qt::Vertical.
s Position of the scale. For a horizontal orientation, the scale position can be Top, Bottom or None. A vertical thermometer may have the scale positions Left, Right or None. The default is None.

Definition at line 214 of file qwt_thermo.cpp.

References Bottom, d_orient, d_scalePos, layoutThermo(), Left, None, Right, and Top.

void QwtThermo::setPipeWidth int  w  ) 
 

Change the width of the pipe.

Definition at line 471 of file qwt_thermo.cpp.

References d_thermoWidth, and layoutThermo().

void QwtThermo::setRange double  vmin,
double  vmax
 

Set the range.

Parameters:
vmin Value corresponding lower or left end of the thermometer
vmax Value corresponding to the upper or right end of the thermometer

Definition at line 425 of file qwt_thermo.cpp.

References d_map, QwtScaleIf::d_maxMajor, QwtScaleIf::d_maxMinor, d_maxValue, d_minValue, QwtScaleIf::d_scaleDraw, QwtScaleIf::hasUserScale(), layoutThermo(), scaleChange(), QwtScaleDraw::scaleDiv(), QwtDiMap::setDblRange(), and QwtScaleDraw::setScale().

void QwtThermo::setValue double  val  )  [slot]
 

Set the current value.

Definition at line 56 of file qwt_thermo.cpp.

References d_value.

QSize QwtThermo::sizeHint  )  const [virtual]
 

Returns:
the minimum size hint
See also:
QwtThermo::minimumSizeHint

Definition at line 536 of file qwt_thermo.cpp.

References minimumSizeHint().

QSizePolicy QwtThermo::sizePolicy  )  const [virtual]
 

Returns:
Fixed/MinimumExpanding for vertical, MinimumExpanding/Fixed for horizontal thermos.

Definition at line 515 of file qwt_thermo.cpp.

References QwtScaleIf::d_scaleDraw, QwtScaleDraw::Left, QwtScaleDraw::orientation(), and QwtScaleDraw::Right.

double QwtThermo::value  )  [inline]
 

Returns:
value

Definition at line 52 of file qwt_thermo.h.


Member Data Documentation

QColor QwtThermo::d_alarmColor [private]
 

Definition at line 77 of file qwt_thermo.h.

Referenced by drawThermo(), init(), and setAlarmColor().

int QwtThermo::d_alarmEnabled [private]
 

Definition at line 89 of file qwt_thermo.h.

Referenced by drawThermo(), init(), setAlarmEnabled(), and setAlarmLevel().

double QwtThermo::d_alarmLevel [private]
 

Definition at line 88 of file qwt_thermo.h.

Referenced by drawThermo(), init(), and setAlarmLevel().

int QwtThermo::d_borderWidth [private]
 

Definition at line 81 of file qwt_thermo.h.

Referenced by draw(), init(), layoutThermo(), minimumSizeHint(), and setBorderWidth().

QColor QwtThermo::d_fillColor [private]
 

Definition at line 76 of file qwt_thermo.h.

Referenced by drawThermo(), init(), and setFillColor().

QwtDiMap QwtThermo::d_map [private]
 

Definition at line 74 of file qwt_thermo.h.

Referenced by drawThermo(), init(), layoutThermo(), and setRange().

double QwtThermo::d_maxValue [private]
 

Definition at line 86 of file qwt_thermo.h.

Referenced by drawThermo(), init(), and setRange().

double QwtThermo::d_minValue [private]
 

Definition at line 85 of file qwt_thermo.h.

Referenced by drawThermo(), init(), and setRange().

Qt::Orientation QwtThermo::d_orient [private]
 

Definition at line 79 of file qwt_thermo.h.

Referenced by drawThermo(), init(), layoutThermo(), minimumSizeHint(), and setOrientation().

int QwtThermo::d_scaleDist [private]
 

Definition at line 82 of file qwt_thermo.h.

Referenced by init(), layoutThermo(), and minimumSizeHint().

ScalePos QwtThermo::d_scalePos [private]
 

Definition at line 80 of file qwt_thermo.h.

Referenced by draw(), init(), layoutThermo(), minimumSizeHint(), and setOrientation().

QRect QwtThermo::d_thermoRect [private]
 

Definition at line 75 of file qwt_thermo.h.

Referenced by draw(), drawThermo(), layoutThermo(), and setBorderWidth().

int QwtThermo::d_thermoWidth [private]
 

Definition at line 83 of file qwt_thermo.h.

Referenced by init(), layoutThermo(), minimumSizeHint(), and setPipeWidth().

double QwtThermo::d_value [private]
 

Definition at line 87 of file qwt_thermo.h.

Referenced by drawThermo(), init(), and setValue().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 14:11:50 2003 for Qwt Developer's Guide by doxygen 1.3.2