QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 类型 | Public 槽 | Public 成员函数 | Protected 成员函数 | 属性 | 所有成员列表
QwtThermo类 参考

The Thermometer Widget 更多...

#include <qwt_thermo.h>

类 QwtThermo 继承关系图:
QwtAbstractScale

class  PrivateData
 

Public 类型

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

Public 槽

virtual void setValue (double)
 Set the current value
 

Public 成员函数

 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 成员函数 继承自 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 成员函数

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 成员函数 继承自 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)
 

属性

Qt::Orientation orientation
 
ScalePosition scalePosition
 
OriginMode originMode
 
bool alarmEnabled
 
double alarmLevel
 
double origin
 
int spacing
 
int borderWidth
 
int pipeWidth
 
bool flatStyle
 
double value
 
- 属性 继承自 QwtAbstractScale
double lowerBound
 
double upperBound
 
int scaleMaxMajor
 
int scaleMaxMinor
 
double scaleStepSize
 

详细描述

The Thermometer Widget

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

成员枚举类型说明

◆ OriginMode

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

参见
setOriginMode(), setOrigin()
枚举值
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

参见
setScalePosition(), setOrientation()
枚举值
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

构造及析构函数说明

◆ QwtThermo()

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

Constructor

参数
parentParent widget
参见
~QwtThermo()

Destructor

参见
QwtThermo()

成员函数说明

◆ alarmBrush()

QBrush QwtThermo::alarmBrush ( ) const

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

参见
setAlarmBrush(), QWidget::palette()
警告
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

参见
setAlarmEnabled()
警告
The alarm threshold has no effect when a color map has been assigned

◆ alarmLevel()

double QwtThermo::alarmLevel ( ) const

Return alarm threshold

参见
setAlarmLevel()
警告
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

参数
fillRectFilled rectangle in the pipe
返回
Rectangle to be filled with the alarm brush
参见
pipeRect(), fillRect(), alarmLevel(), alarmBrush()

◆ borderWidth()

int QwtThermo::borderWidth ( ) const

Return border width of the thermometer pipe

参见
setBorderWidth()

◆ changeEvent()

void QwtThermo::changeEvent ( QEvent *  event)
overrideprotectedvirtual

Handle change events

Qt change event handler

参数
eventEvent
参见
paintEvent(), resizeEvent()

重载 QwtAbstractScale .

◆ colorMap() [1/2]

QwtColorMap * QwtThermo::colorMap ( )

Return color map for the fill color

警告
The alarm threshold has no effect when a color map has been assigned
参见
setColorMap()

◆ colorMap() [2/2]

const QwtColorMap * QwtThermo::colorMap ( ) const

Return color map for the fill color (const version)

警告
The alarm threshold has no effect when a color map has been assigned
参见
setColorMap()

◆ drawLiquid()

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

Draw the liquid

Redraw the liquid in thermometer pipe

参数
painterPainter
pipeRectBounding rectangle of the pipe without borders
参见
pipeRect(), fillRect(), alarmRect()

◆ fillBrush()

QBrush QwtThermo::fillBrush ( ) const

Return liquid (QPalette::ButtonText) brush

参见
setFillBrush(), QWidget::palette()

◆ fillRect()

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

Return the fill rectangle

Calculate the filled rectangle of the pipe

参数
pipeRectRectangle of the pipe
返回
Rectangle to be filled (fill and alarm brush)
参见
pipeRect(), alarmRect()

◆ flatStyle()

bool QwtThermo::flatStyle ( ) const

Return whether flat style is enabled

参见
setFlatStyle()

◆ minimumSizeHint()

QSize QwtThermo::minimumSizeHint ( ) const
overridevirtual

Return minimum size hint

The return value depends on the font and the scale.

参见
sizeHint()

◆ orientation()

Qt::Orientation QwtThermo::orientation ( ) const

Return orientation

参见
setOrientation()

◆ origin()

double QwtThermo::origin ( ) const

Return origin of the thermometer when OriginCustom is enabled

参见
setOrigin(), setOriginMode(), originMode()

◆ originMode()

QwtThermo::OriginMode QwtThermo::originMode ( ) const

Return mode how the origin is determined

参见
setOriginMode(), setOrigin(), origin()

◆ paintEvent()

void QwtThermo::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Handle paint events

Paint event handler

参数
eventPaint event
参见
resizeEvent(), changeEvent()

◆ pipeRect()

QRect QwtThermo::pipeRect ( ) const
protected

Return the pipe rectangle

Return bounding rectangle of the pipe

返回
Bounding rectangle of the pipe (without borders) in widget coordinates
参见
fillRect(), alarmRect()

◆ pipeWidth()

int QwtThermo::pipeWidth ( ) const

Return width of the pipe

参见
setPipeWidth()

◆ rangeFlags()

QwtInterval::BorderFlags QwtThermo::rangeFlags ( ) const

Return range flags

参见
setRangeFlags()

◆ resizeEvent()

void QwtThermo::resizeEvent ( QResizeEvent *  event)
overrideprotectedvirtual

Handle resize events

Resize event handler

参数
eventResize event
参见
paintEvent(), layoutThermo()

◆ scaleChange()

void QwtThermo::scaleChange ( )
overrideprotectedvirtual

Handle scale changes

Notify a scale change

参见
scaleChange()

重载 QwtAbstractScale .

◆ scaleDraw() [1/2]

QwtScaleDraw * QwtThermo::scaleDraw ( )
protected

Return the scale draw

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

参见
setScaleDraw()

◆ scaleDraw() [2/2]

const QwtScaleDraw * QwtThermo::scaleDraw ( ) const

Return the scale draw of the thermometer (const version)

参见
setScaleDraw()

◆ scalePosition()

QwtThermo::ScalePosition QwtThermo::scalePosition ( ) const

Return scale position

参见
setScalePosition()

◆ setAlarmBrush()

void QwtThermo::setAlarmBrush ( const QBrush &  brush)

Specify the liquid brush above the alarm threshold

Changes the QPalette::Highlight brush of the palette.

参数
brushNew brush
参见
alarmBrush(), QWidget::setPalette()
警告
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

参数
onTrue to enable, false to disable
参见
alarmEnabled()
警告
The alarm threshold has no effect when a color map has been assigned

◆ setAlarmLevel()

void QwtThermo::setAlarmLevel ( double  level)

Specify the alarm threshold

参数
levelAlarm threshold
参见
alarmLevel()
警告
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

参数
widthBorder width
参见
borderWidth()

◆ setColorMap()

void QwtThermo::setColorMap ( QwtColorMap colorMap)

Assign a color map for the fill color

参数
colorMapColor map
警告
The alarm threshold has no effect when a color map has been assigned
参见
colorMap()

◆ setFillBrush()

void QwtThermo::setFillBrush ( const QBrush &  brush)

Change the brush of the liquid

Changes the QPalette::ButtonText brush of the palette.

参数
brushNew brush
参见
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).

参数
ontrue for flat style, false for classic 3D style
参见
flatStyle()

◆ setOrientation()

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

Set the orientation

参数
orientationAllowed values are Qt::Horizontal and Qt::Vertical
参见
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.

参数
originNew origin level
参见
setOriginMode(), originMode(), origin()

◆ setOriginMode()

void QwtThermo::setOriginMode ( OriginMode  m)

Change how the origin is determined

参见
originMode(), setOrigin(), origin()

◆ setPipeWidth()

void QwtThermo::setPipeWidth ( int  width)

Change the width of the pipe

参数
widthWidth of the pipe
参见
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.

参数
flagsRange flags
参见
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().

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

◆ setScalePosition()

void QwtThermo::setScalePosition ( ScalePosition  scalePosition)

Change the position of the scale

参数
scalePositionPosition of the scale
参见
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.

参数
spacingNumber of pixels
参见
spacing()

◆ setValue

void QwtThermo::setValue ( double  value)
virtualslot

Set the current value

参数
valueNew value
参见
value()

◆ sizeHint()

QSize QwtThermo::sizeHint ( ) const
overridevirtual

Return the minimum size hint

参见
minimumSizeHint()

◆ spacing()

int QwtThermo::spacing ( ) const

Return number of pixels between pipe and scale

参见
setSpacing()

◆ value()

double QwtThermo::value ( ) const

Return the value

参见
setValue()

该类的文档由以下文件生成: