QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Slots | Public Member Functions | Protected Member Functions | Properties | List of all members
QwtThermo Class Reference

The Thermometer Widget. More...

#include <qwt_thermo.h>

Inheritance diagram for QwtThermo:
QwtAbstractScale

Classes

class  PrivateData
 

Public Types

enum  ScalePosition { NoScale , LeadingScale , TrailingScale }
 Position of the scale. More...
 
enum  OriginMode { OriginMinimum , OriginMaximum , OriginCustom }
 Origin mode. This property specifies where the beginning of the liquid is placed. More...
 

Public Slots

virtual void setValue (double)
 Set the current value.
 

Public Member Functions

 QwtThermo (QWidget *parent=nullptr)
 Constructor.
 
void setOrientation (Qt::Orientation)
 Set the orientation.
 
Qt::Orientation orientation () const
 Return orientation.
 
void setScalePosition (ScalePosition)
 Change the position of the scale.
 
ScalePosition scalePosition () const
 Return scale position.
 
void setSpacing (int)
 Change the spacing between pipe and scale.
 
int spacing () const
 Return number of pixels between pipe and scale.
 
void setBorderWidth (int)
 Set the border width of the pipe.
 
int borderWidth () const
 Return border width of the thermometer pipe.
 
void setOriginMode (OriginMode)
 Change how the origin is determined.
 
OriginMode originMode () const
 Return mode how the origin is determined.
 
void setOrigin (double)
 Specify the custom origin.
 
double origin () const
 Return origin of the thermometer when OriginCustom is enabled.
 
void setFillBrush (const QBrush &)
 Change the brush of the liquid.
 
QBrush fillBrush () const
 Return liquid (QPalette::ButtonText) brush.
 
void setAlarmBrush (const QBrush &)
 Specify the liquid brush above the alarm threshold.
 
QBrush alarmBrush () const
 Return liquid brush (QPalette::Highlight) above the alarm threshold.
 
void setAlarmLevel (double)
 Specify the alarm threshold.
 
double alarmLevel () const
 Return alarm threshold.
 
void setAlarmEnabled (bool)
 Enable or disable the alarm threshold.
 
bool alarmEnabled () const
 Return true when the alarm threshold is enabled.
 
void setColorMap (QwtColorMap *)
 Assign a color map for the fill color.
 
QwtColorMapcolorMap ()
 Return color map for the fill color.
 
const QwtColorMapcolorMap () const
 Return color map for the fill color (const version)
 
void setPipeWidth (int)
 Change the width of the pipe.
 
int pipeWidth () const
 Return width of the pipe.
 
void setFlatStyle (bool)
 Set flat style.
 
bool flatStyle () const
 Return whether flat style is enabled.
 
void setRangeFlags (QwtInterval::BorderFlags)
 Exclude/Include min/max values.
 
QwtInterval::BorderFlags rangeFlags () const
 Return range flags.
 
double value () const
 Return the value.
 
virtual QSize sizeHint () const override
 Return the minimum size hint.
 
virtual QSize minimumSizeHint () const override
 Return minimum size hint.
 
void setScaleDraw (QwtScaleDraw *)
 Set a scale draw.
 
const QwtScaleDrawscaleDraw () const
 Return the scale draw of the thermometer (const version)
 
- Public Member Functions inherited from QwtAbstractScale
 QwtAbstractScale (QWidget *parent=nullptr)
 Constructor for QwtAbstractScale.
 
void setScale (double lowerBound, double upperBound)
 Specify a scale by interval bounds.
 
void setScale (const QwtInterval &)
 Specify a scale by interval.
 
void setScale (const QwtScaleDiv &)
 Specify a scale by scale division.
 
const QwtScaleDivscaleDiv () const
 Return the scale division.
 
void setLowerBound (double value)
 Set the lower bound of the scale.
 
double lowerBound () const
 Return the lower bound of the scale.
 
void setUpperBound (double value)
 Set the upper bound of the scale.
 
double upperBound () const
 Return the upper bound of the scale.
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating scale division.
 
double scaleStepSize () const
 Return the step size hint.
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals.
 
int scaleMaxMinor () const
 Return the maximum number of minor tick intervals.
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals.
 
int scaleMaxMajor () const
 Return the maximum number of major tick intervals.
 
void setScaleEngine (QwtScaleEngine *)
 Set the scale engine.
 
const QwtScaleEnginescaleEngine () const
 Return the scale engine (const version)
 
QwtScaleEnginescaleEngine ()
 Return the scale engine (non-const version)
 
int transform (double) const
 Transform a scale value to widget coordinates.
 
double invTransform (int) const
 Transform a widget coordinate to scale value.
 
bool isInverted () const
 Check if scale is inverted.
 
double minimum () const
 Return the minimum boundary.
 
double maximum () const
 Return the maximum boundary.
 
const QwtScaleMapscaleMap () const
 Return the scale map.
 

Protected Member Functions

virtual void drawLiquid (QPainter *, const QRect &) const
 Draw the liquid.
 
virtual void scaleChange () override
 Handle scale changes.
 
virtual void paintEvent (QPaintEvent *) override
 Handle paint events.
 
virtual void resizeEvent (QResizeEvent *) override
 Handle resize events.
 
virtual void changeEvent (QEvent *) override
 Handle change events.
 
QwtScaleDrawscaleDraw ()
 Return the scale draw.
 
QRect pipeRect () const
 Return the pipe rectangle.
 
QRect fillRect (const QRect &) const
 Return the fill rectangle.
 
QRect alarmRect (const QRect &) const
 Return the alarm rectangle.
 
- Protected Member Functions inherited from QwtAbstractScale
void rescale (double lowerBound, double upperBound, double stepSize)
 Recalculate scale and update scale draw (English only)
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set the scale draw object (English only)
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 Return the scale draw (const version) (English only)
 
QwtAbstractScaleDrawabstractScaleDraw ()
 Return the scale draw (non-const version) (English only)
 
void updateScaleDraw ()
 Update the scale draw (English only)
 

Properties

Qt::Orientation orientation
 
ScalePosition scalePosition
 
OriginMode originMode
 
bool alarmEnabled
 
double alarmLevel
 
double origin
 
int spacing
 
int borderWidth
 
int pipeWidth
 
bool flatStyle
 
double value
 
- Properties inherited from QwtAbstractScale
double lowerBound
 
double upperBound
 
int scaleMaxMajor
 
int scaleMaxMinor
 
double scaleStepSize
 

Detailed Description

The Thermometer Widget.

QwtThermo is a widget which displays a value in an interval. It supports:

Member Enumeration Documentation

◆ OriginMode

Origin mode. This property specifies where the beginning of the liquid is placed.

See also
setOriginMode(), setOrigin()
Enumerator
OriginMinimum 

The origin is the minimum of the scale.

OriginMaximum 

The origin is the maximum of the scale.

OriginCustom 

The origin is specified using the origin() property.

◆ ScalePosition

Position of the scale.

See also
setScalePosition(), setOrientation()
Enumerator
NoScale 

The slider has no scale.

LeadingScale 

The scale is right of a vertical or below of a horizontal slider.

TrailingScale 

The scale is left of a vertical or above of a horizontal slider.

Constructor & Destructor Documentation

◆ QwtThermo()

QwtThermo::QwtThermo ( QWidget *  parent = nullptr)
explicit

Constructor.

Parameters
parentParent widget
See also
~QwtThermo()

Destructor

See also
QwtThermo()

Member Function Documentation

◆ alarmBrush()

QBrush QwtThermo::alarmBrush ( ) const

Return liquid brush (QPalette::Highlight) above the alarm threshold.

See also
setAlarmBrush(), QWidget::palette()
Warning
The alarm threshold has no effect when a color map has been assigned

◆ alarmEnabled()

bool QwtThermo::alarmEnabled ( ) const

Return true when the alarm threshold is enabled.

See also
setAlarmEnabled()
Warning
The alarm threshold has no effect when a color map has been assigned

◆ alarmLevel()

double QwtThermo::alarmLevel ( ) const

Return alarm threshold.

See also
setAlarmLevel()
Warning
The alarm threshold has no effect when a color map has been assigned

◆ alarmRect()

QRect QwtThermo::alarmRect ( const QRect &  fillRect) const
protected

Return the alarm rectangle.

Calculate the alarm rectangle of the pipe.

Parameters
fillRectFilled rectangle in the pipe
Returns
Rectangle to be filled with the alarm brush
See also
pipeRect(), fillRect(), alarmLevel(), alarmBrush()

◆ borderWidth()

int QwtThermo::borderWidth ( ) const

Return border width of the thermometer pipe.

See also
setBorderWidth()

◆ changeEvent()

void QwtThermo::changeEvent ( QEvent *  event)
overrideprotectedvirtual

Handle change events.

Qt change event handler.

Parameters
eventEvent
See also
paintEvent(), resizeEvent()

Reimplemented from QwtAbstractScale.

◆ colorMap() [1/2]

QwtColorMap * QwtThermo::colorMap ( )

Return color map for the fill color.

Warning
The alarm threshold has no effect when a color map has been assigned
See also
setColorMap()

◆ colorMap() [2/2]

const QwtColorMap * QwtThermo::colorMap ( ) const

Return color map for the fill color (const version)

Warning
The alarm threshold has no effect when a color map has been assigned
See also
setColorMap()

◆ drawLiquid()

void QwtThermo::drawLiquid ( QPainter *  painter,
const QRect &  pipeRect 
) const
protectedvirtual

Draw the liquid.

Redraw the liquid in thermometer pipe.

Parameters
painterPainter
pipeRectBounding rectangle of the pipe without borders
See also
pipeRect(), fillRect(), alarmRect()

◆ fillBrush()

QBrush QwtThermo::fillBrush ( ) const

Return liquid (QPalette::ButtonText) brush.

See also
setFillBrush(), QWidget::palette()

◆ fillRect()

QRect QwtThermo::fillRect ( const QRect &  pipeRect) const
protected

Return the fill rectangle.

Calculate the filled rectangle of the pipe.

Parameters
pipeRectRectangle of the pipe
Returns
Rectangle to be filled (fill and alarm brush)
See also
pipeRect(), alarmRect()

◆ flatStyle()

bool QwtThermo::flatStyle ( ) const

Return whether flat style is enabled.

See also
setFlatStyle()

◆ minimumSizeHint()

QSize QwtThermo::minimumSizeHint ( ) const
overridevirtual

Return minimum size hint.

The return value depends on the font and the scale.

See also
sizeHint()

◆ orientation()

Qt::Orientation QwtThermo::orientation ( ) const

Return orientation.

See also
setOrientation()

◆ origin()

double QwtThermo::origin ( ) const

Return origin of the thermometer when OriginCustom is enabled.

See also
setOrigin(), setOriginMode(), originMode()

◆ originMode()

QwtThermo::OriginMode QwtThermo::originMode ( ) const

Return mode how the origin is determined.

See also
setOriginMode(), setOrigin(), origin()

◆ paintEvent()

void QwtThermo::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Handle paint events.

Paint event handler.

Parameters
eventPaint event
See also
resizeEvent(), changeEvent()

◆ pipeRect()

QRect QwtThermo::pipeRect ( ) const
protected

Return the pipe rectangle.

Return bounding rectangle of the pipe.

Returns
Bounding rectangle of the pipe (without borders) in widget coordinates
See also
fillRect(), alarmRect()

◆ pipeWidth()

int QwtThermo::pipeWidth ( ) const

Return width of the pipe.

See also
setPipeWidth()

◆ rangeFlags()

QwtInterval::BorderFlags QwtThermo::rangeFlags ( ) const

Return range flags.

See also
setRangeFlags()

◆ resizeEvent()

void QwtThermo::resizeEvent ( QResizeEvent *  event)
overrideprotectedvirtual

Handle resize events.

Resize event handler.

Parameters
eventResize event
See also
paintEvent(), layoutThermo()

◆ scaleChange()

void QwtThermo::scaleChange ( )
overrideprotectedvirtual

Handle scale changes.

Notify a scale change.

See also
scaleChange()

Reimplemented from QwtAbstractScale.

◆ scaleDraw() [1/2]

QwtScaleDraw * QwtThermo::scaleDraw ( )
protected

Return the scale draw.

Return the scale draw of the thermometer (non-const version)

See also
setScaleDraw()

◆ scaleDraw() [2/2]

const QwtScaleDraw * QwtThermo::scaleDraw ( ) const

Return the scale draw of the thermometer (const version)

See also
setScaleDraw()

◆ scalePosition()

QwtThermo::ScalePosition QwtThermo::scalePosition ( ) const

Return scale position.

See also
setScalePosition()

◆ setAlarmBrush()

void QwtThermo::setAlarmBrush ( const QBrush &  brush)

Specify the liquid brush above the alarm threshold.

Changes the QPalette::Highlight brush of the palette.

Parameters
brushNew brush
See also
alarmBrush(), QWidget::setPalette()
Warning
The alarm threshold has no effect when a color map has been assigned

◆ setAlarmEnabled()

void QwtThermo::setAlarmEnabled ( bool  on)

Enable or disable the alarm threshold.

Parameters
onTrue to enable, false to disable
See also
alarmEnabled()
Warning
The alarm threshold has no effect when a color map has been assigned

◆ setAlarmLevel()

void QwtThermo::setAlarmLevel ( double  level)

Specify the alarm threshold.

Parameters
levelAlarm threshold
See also
alarmLevel()
Warning
The alarm threshold has no effect when a color map has been assigned

◆ setBorderWidth()

void QwtThermo::setBorderWidth ( int  width)

Set the border width of the pipe.

Parameters
widthBorder width
See also
borderWidth()

◆ setColorMap()

void QwtThermo::setColorMap ( QwtColorMap colorMap)

Assign a color map for the fill color.

Parameters
colorMapColor map
Warning
The alarm threshold has no effect when a color map has been assigned
See also
colorMap()

◆ setFillBrush()

void QwtThermo::setFillBrush ( const QBrush &  brush)

Change the brush of the liquid.

Changes the QPalette::ButtonText brush of the palette.

Parameters
brushNew brush
See also
fillBrush(), QWidget::setPalette()

◆ setFlatStyle()

void QwtThermo::setFlatStyle ( bool  on)

Set flat style.

When enabled (default), the pipe border is drawn with a flat solid-color line instead of a 3D embossed effect (qDrawShadePanel).

Parameters
ontrue for flat style, false for classic 3D style
See also
flatStyle()

◆ setOrientation()

void QwtThermo::setOrientation ( Qt::Orientation  orientation)

Set the orientation.

Parameters
orientationAllowed values are Qt::Horizontal and Qt::Vertical
See also
orientation(), scalePosition()

◆ setOrigin()

void QwtThermo::setOrigin ( double  origin)

Specify the custom origin.

If originMode is set to OriginCustom this property controls where the liquid starts.

Parameters
originNew origin level
See also
setOriginMode(), originMode(), origin()

◆ setOriginMode()

void QwtThermo::setOriginMode ( OriginMode  m)

Change how the origin is determined.

See also
originMode(), setOrigin(), origin()

◆ setPipeWidth()

void QwtThermo::setPipeWidth ( int  width)

Change the width of the pipe.

Parameters
widthWidth of the pipe
See also
pipeWidth()

◆ setRangeFlags()

void QwtThermo::setRangeFlags ( QwtInterval::BorderFlags  flags)

Exclude/Include min/max values.

According to the flags minValue() and maxValue() are included/excluded from the pipe. In case of an excluded value the corresponding tick is painted 1 pixel off of the pipeRect(). For example, when a minimum of 0.0 has to be displayed as an empty pipe, the minValue() needs to be excluded.

Parameters
flagsRange flags
See also
rangeFlags()

◆ setScaleDraw()

void QwtThermo::setScaleDraw ( QwtScaleDraw scaleDraw)

Set a scale draw.

For changing the labels of the scales, it is necessary to derive from QwtScaleDraw and overload QwtScaleDraw::label().

Parameters
scaleDrawScaleDraw object that has to be created with new and will be deleted in ~QwtThermo() or the next call of setScaleDraw()
See also
scaleDraw(), QwtScaleDraw

◆ setScalePosition()

void QwtThermo::setScalePosition ( ScalePosition  scalePosition)

Change the position of the scale.

Parameters
scalePositionPosition of the scale
See also
ScalePosition, scalePosition()

◆ setSpacing()

void QwtThermo::setSpacing ( int  spacing)

Change the spacing between pipe and scale.

A spacing of 0 means that the backbone of the scale is below the pipe. The default setting is 3 pixels.

Parameters
spacingNumber of pixels
See also
spacing()

◆ setValue

void QwtThermo::setValue ( double  value)
virtualslot

Set the current value.

Parameters
valueNew value
See also
value()

◆ sizeHint()

QSize QwtThermo::sizeHint ( ) const
overridevirtual

Return the minimum size hint.

See also
minimumSizeHint()

◆ spacing()

int QwtThermo::spacing ( ) const

Return number of pixels between pipe and scale.

See also
setSpacing()

◆ value()

double QwtThermo::value ( ) const

Return the value.

See also
setValue()

The documentation for this class was generated from the following files: