|
QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
|
The Thermometer Widget 更多...
#include <qwt_thermo.h>
类 | |
| 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 | |
| QwtColorMap * | colorMap () |
| Return color map for the fill color | |
| const QwtColorMap * | colorMap () 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 QwtScaleDraw * | scaleDraw () 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 QwtScaleDiv & | scaleDiv () 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 QwtScaleEngine * | scaleEngine () const |
| Return the scale engine (const version) | |
| QwtScaleEngine * | scaleEngine () |
| 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 QwtScaleMap & | scaleMap () 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 | |
| QwtScaleDraw * | scaleDraw () |
| 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 QwtAbstractScaleDraw * | abstractScaleDraw () const |
| Return the scale draw (const version) (English only) | |
| QwtAbstractScaleDraw * | abstractScaleDraw () |
| 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:
|
explicit |
| QBrush QwtThermo::alarmBrush | ( | ) | const |
Return liquid brush (QPalette::Highlight) above the alarm threshold
| bool QwtThermo::alarmEnabled | ( | ) | const |
Return true when the alarm threshold is enabled
| double QwtThermo::alarmLevel | ( | ) | const |
Return alarm threshold
|
protected |
Return the alarm rectangle
Calculate the alarm rectangle of the pipe
| fillRect | Filled rectangle in the pipe |
| int QwtThermo::borderWidth | ( | ) | const |
Return border width of the thermometer pipe
|
overrideprotectedvirtual |
| QwtColorMap * QwtThermo::colorMap | ( | ) |
Return color map for the fill color
| const QwtColorMap * QwtThermo::colorMap | ( | ) | const |
Return color map for the fill color (const version)
|
protectedvirtual |
Draw the liquid
Redraw the liquid in thermometer pipe
| painter | Painter |
| pipeRect | Bounding rectangle of the pipe without borders |
| QBrush QwtThermo::fillBrush | ( | ) | const |
Return liquid (QPalette::ButtonText) brush
|
protected |
Return the fill rectangle
Calculate the filled rectangle of the pipe
| pipeRect | Rectangle of the pipe |
| bool QwtThermo::flatStyle | ( | ) | const |
Return whether flat style is enabled
|
overridevirtual |
| Qt::Orientation QwtThermo::orientation | ( | ) | const |
Return orientation
| double QwtThermo::origin | ( | ) | const |
Return origin of the thermometer when OriginCustom is enabled
| QwtThermo::OriginMode QwtThermo::originMode | ( | ) | const |
Return mode how the origin is determined
|
overrideprotectedvirtual |
|
protected |
Return the pipe rectangle
Return bounding rectangle of the pipe
| int QwtThermo::pipeWidth | ( | ) | const |
Return width of the pipe
| QwtInterval::BorderFlags QwtThermo::rangeFlags | ( | ) | const |
Return range flags
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
protected |
| const QwtScaleDraw * QwtThermo::scaleDraw | ( | ) | const |
Return the scale draw of the thermometer (const version)
| QwtThermo::ScalePosition QwtThermo::scalePosition | ( | ) | const |
Return scale position
| void QwtThermo::setAlarmBrush | ( | const QBrush & | brush | ) |
Specify the liquid brush above the alarm threshold
Changes the QPalette::Highlight brush of the palette.
| brush | New brush |
| void QwtThermo::setAlarmEnabled | ( | bool | on | ) |
Enable or disable the alarm threshold
| on | True to enable, false to disable |
| void QwtThermo::setAlarmLevel | ( | double | level | ) |
Specify the alarm threshold
| level | Alarm threshold |
| void QwtThermo::setBorderWidth | ( | int | width | ) |
Set the border width of the pipe
| width | Border width |
| void QwtThermo::setColorMap | ( | QwtColorMap * | colorMap | ) |
Assign a color map for the fill color
| colorMap | Color map |
| void QwtThermo::setFillBrush | ( | const QBrush & | brush | ) |
Change the brush of the liquid
Changes the QPalette::ButtonText brush of the palette.
| brush | New brush |
| 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).
| on | true for flat style, false for classic 3D style |
| void QwtThermo::setOrientation | ( | Qt::Orientation | orientation | ) |
Set the orientation
| orientation | Allowed values are Qt::Horizontal and Qt::Vertical |
| void QwtThermo::setOrigin | ( | double | origin | ) |
Specify the custom origin
If originMode is set to OriginCustom this property controls where the liquid starts.
| origin | New origin level |
| void QwtThermo::setOriginMode | ( | OriginMode | m | ) |
Change how the origin is determined
| void QwtThermo::setPipeWidth | ( | int | width | ) |
Change the width of the pipe
| width | Width of the pipe |
| 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.
| flags | Range flags |
| 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().
| scaleDraw | ScaleDraw object that has to be created with new and will be deleted in ~QwtThermo() or the next call of setScaleDraw() |
| void QwtThermo::setScalePosition | ( | ScalePosition | scalePosition | ) |
Change the position of the scale
| scalePosition | Position of the scale |
| 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.
| spacing | Number of pixels |
|
virtualslot |
Set the current value
| value | New value |
|
overridevirtual |
Return the minimum size hint
| int QwtThermo::spacing | ( | ) | const |
Return number of pixels between pipe and scale
| double QwtThermo::value | ( | ) | const |
Return the value