The Thermometer Widget. More...
#include <qwt_thermo.h>
Classes | |
class | PrivateData |
Public Types | |
enum | ScalePos { NoScale, LeftScale, RightScale, TopScale, BottomScale } |
Public Slots | |
void | setValue (double val) |
Public Member Functions | |
QwtThermo (QWidget *parent=NULL) | |
QwtThermo (QWidget *parent, const char *name) | |
virtual | ~QwtThermo () |
Destructor. | |
void | setOrientation (Qt::Orientation o, ScalePos s) |
Set the thermometer orientation and the scale position. | |
void | setScalePosition (ScalePos s) |
Change the scale position (and thermometer orientation). | |
ScalePos | scalePosition () const |
void | setBorderWidth (int w) |
int | borderWidth () const |
void | setFillBrush (const QBrush &b) |
Change the brush of the liquid. | |
const QBrush & | fillBrush () const |
void | setFillColor (const QColor &c) |
Change the color of the liquid. | |
const QColor & | fillColor () const |
void | setAlarmBrush (const QBrush &b) |
Specify the liquid brush above the alarm threshold. | |
const QBrush & | alarmBrush () const |
void | setAlarmColor (const QColor &c) |
Specify the liquid color above the alarm threshold. | |
const QColor & | alarmColor () const |
void | setAlarmLevel (double v) |
double | alarmLevel () const |
void | setAlarmEnabled (bool tf) |
Enable or disable the alarm threshold. | |
bool | alarmEnabled () const |
void | setPipeWidth (int w) |
int | pipeWidth () const |
void | setMaxValue (double v) |
double | maxValue () const |
void | setMinValue (double v) |
double | minValue () const |
double | value () const |
void | setRange (double vmin, double vmax, bool lg=false) |
Set the range. | |
void | setMargin (int m) |
Specify the distance between the pipe's endpoints and the widget's border. | |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
Return a minimum size hint. | |
void | setScaleDraw (QwtScaleDraw *) |
Set a scale draw. | |
const QwtScaleDraw * | scaleDraw () const |
Protected Member Functions | |
void | draw (QPainter *p, const QRect &update_rect) |
void | drawThermo (QPainter *p) |
void | layoutThermo (bool update=true) |
virtual void | scaleChange () |
Notify a scale change. | |
virtual void | fontChange (const QFont &oldFont) |
Notify a font change. | |
virtual void | paintEvent (QPaintEvent *e) |
virtual void | resizeEvent (QResizeEvent *e) |
Qt resize event handler. | |
QwtScaleDraw * | scaleDraw () |
Properties | |
QBrush | alarmBrush |
QColor | alarmColor |
Return the liquid color above the alarm threshold. | |
bool | alarmEnabled |
Return if the alarm threshold is enabled or disabled. | |
double | alarmLevel |
ScalePos | scalePosition |
int | borderWidth |
QBrush | fillBrush |
QColor | fillColor |
double | maxValue |
Return the maximum value. | |
double | minValue |
Return the minimum value. | |
int | pipeWidth |
double | value |
Return the value. |
The Thermometer Widget.
QwtThermo is a widget which displays a value in an interval. It supports:
By default, the scale and range run over the same interval of values. QwtAbstractScale::setScale() changes the interval of the scale and allows easy conversion between physical units.
The example shows how to make the scale indicate in degrees Fahrenheit and to set the value in degrees Kelvin:
#include <qapplication.h> #include <qwt_thermo.h> double Kelvin2Fahrenheit(double kelvin) { // see http://en.wikipedia.org/wiki/Kelvin return 1.8*kelvin - 459.67; } int main(int argc, char **argv) { const double minKelvin = 0.0; const double maxKelvin = 500.0; QApplication a(argc, argv); QwtThermo t; t.setRange(minKelvin, maxKelvin); t.setScale(Kelvin2Fahrenheit(minKelvin), Kelvin2Fahrenheit(maxKelvin)); // set the value in Kelvin but the scale displays in Fahrenheit // 273.15 Kelvin = 0 Celsius = 32 Fahrenheit t.setValue(273.15); a.setMainWidget(&t); t.show(); return a.exec(); }
Definition at line 69 of file qwt_thermo.h.
enum QwtThermo::ScalePos |
Definition at line 98 of file qwt_thermo.h.
{ NoScale, LeftScale, RightScale, TopScale, BottomScale };
QwtThermo::QwtThermo | ( | QWidget * | parent = NULL ) |
[explicit] |
Constructor
parent | Parent widget |
Definition at line 64 of file qwt_thermo.cpp.
: QWidget(parent) { initThermo(); }
QwtThermo::QwtThermo | ( | QWidget * | parent, |
const char * | name | ||
) | [explicit] |
Constructor
parent | Parent widget |
name | Object name |
Definition at line 76 of file qwt_thermo.cpp.
: QWidget(parent, name) { initThermo(); }
QwtThermo::~QwtThermo | ( | ) | [virtual] |
const QBrush& QwtThermo::alarmBrush | ( | ) | const |
const QColor& QwtThermo::alarmColor | ( | ) | const |
bool QwtThermo::alarmEnabled | ( | ) | const |
double QwtThermo::alarmLevel | ( | ) | const |
int QwtThermo::borderWidth | ( | ) | const |
void QwtThermo::draw | ( | QPainter * | painter, |
const QRect & | rect | ||
) | [protected] |
Draw the whole QwtThermo.
painter | Painter |
rect | Update rectangle |
Definition at line 225 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::borderWidth, QwtAbstractScaleDraw::draw(), drawThermo(), NoScale, scaleDraw(), QwtThermo::PrivateData::scalePos, and QwtThermo::PrivateData::thermoRect.
Referenced by paintEvent().
{ if ( !d_data->thermoRect.contains(rect) ) { if (d_data->scalePos != NoScale) { #if QT_VERSION < 0x040000 scaleDraw()->draw(painter, colorGroup()); #else scaleDraw()->draw(painter, palette()); #endif } qDrawShadePanel(painter, d_data->thermoRect.x() - d_data->borderWidth, d_data->thermoRect.y() - d_data->borderWidth, d_data->thermoRect.width() + 2 * d_data->borderWidth, d_data->thermoRect.height() + 2 * d_data->borderWidth, #if QT_VERSION < 0x040000 colorGroup(), #else palette(), #endif true, d_data->borderWidth, 0); } drawThermo(painter); }
void QwtThermo::drawThermo | ( | QPainter * | painter ) | [protected] |
Redraw the liquid in thermometer pipe.
painter | Painter |
Definition at line 489 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::alarmBrush, QwtThermo::PrivateData::alarmEnabled, QwtThermo::PrivateData::alarmLevel, QwtThermo::PrivateData::fillBrush, QwtThermo::PrivateData::maxValue, QwtThermo::PrivateData::minValue, QwtThermo::PrivateData::orientation, QwtThermo::PrivateData::thermoRect, and QwtThermo::PrivateData::value.
Referenced by draw().
{ int alarm = 0, taval = 0; QRect fRect; QRect aRect; QRect bRect; int inverted = ( d_data->maxValue < d_data->minValue ); // // Determine if value exceeds alarm threshold. // Note: The alarm value is allowed to lie // outside the interval (minValue, maxValue). // if (d_data->alarmEnabled) { if (inverted) { alarm = ((d_data->alarmLevel >= d_data->maxValue) && (d_data->alarmLevel <= d_data->minValue) && (d_data->value >= d_data->alarmLevel)); } else { alarm = (( d_data->alarmLevel >= d_data->minValue) && (d_data->alarmLevel <= d_data->maxValue) && (d_data->value >= d_data->alarmLevel)); } } // // transform values // int tval = transform(d_data->value); if (alarm) taval = transform(d_data->alarmLevel); // // calculate recangles // if ( d_data->orientation == Qt::Horizontal ) { if (inverted) { bRect.setRect(d_data->thermoRect.x(), d_data->thermoRect.y(), tval - d_data->thermoRect.x(), d_data->thermoRect.height()); if (alarm) { aRect.setRect(tval, d_data->thermoRect.y(), taval - tval + 1, d_data->thermoRect.height()); fRect.setRect(taval + 1, d_data->thermoRect.y(), d_data->thermoRect.x() + d_data->thermoRect.width() - (taval + 1), d_data->thermoRect.height()); } else { fRect.setRect(tval, d_data->thermoRect.y(), d_data->thermoRect.x() + d_data->thermoRect.width() - tval, d_data->thermoRect.height()); } } else { bRect.setRect(tval + 1, d_data->thermoRect.y(), d_data->thermoRect.width() - (tval + 1 - d_data->thermoRect.x()), d_data->thermoRect.height()); if (alarm) { aRect.setRect(taval, d_data->thermoRect.y(), tval - taval + 1, d_data->thermoRect.height()); fRect.setRect(d_data->thermoRect.x(), d_data->thermoRect.y(), taval - d_data->thermoRect.x(), d_data->thermoRect.height()); } else { fRect.setRect(d_data->thermoRect.x(), d_data->thermoRect.y(), tval - d_data->thermoRect.x() + 1, d_data->thermoRect.height()); } } } else // Qt::Vertical { if (tval < d_data->thermoRect.y()) tval = d_data->thermoRect.y(); else { if (tval > d_data->thermoRect.y() + d_data->thermoRect.height()) tval = d_data->thermoRect.y() + d_data->thermoRect.height(); } if (inverted) { bRect.setRect(d_data->thermoRect.x(), tval + 1, d_data->thermoRect.width(), d_data->thermoRect.height() - (tval + 1 - d_data->thermoRect.y())); if (alarm) { aRect.setRect(d_data->thermoRect.x(), taval, d_data->thermoRect.width(), tval - taval + 1); fRect.setRect(d_data->thermoRect.x(), d_data->thermoRect.y(), d_data->thermoRect.width(), taval - d_data->thermoRect.y()); } else { fRect.setRect(d_data->thermoRect.x(), d_data->thermoRect.y(), d_data->thermoRect.width(), tval - d_data->thermoRect.y() + 1); } } else { bRect.setRect(d_data->thermoRect.x(), d_data->thermoRect.y(), d_data->thermoRect.width(), tval - d_data->thermoRect.y()); if (alarm) { aRect.setRect(d_data->thermoRect.x(),tval, d_data->thermoRect.width(), taval - tval + 1); fRect.setRect(d_data->thermoRect.x(),taval + 1, d_data->thermoRect.width(), d_data->thermoRect.y() + d_data->thermoRect.height() - (taval + 1)); } else { fRect.setRect(d_data->thermoRect.x(),tval, d_data->thermoRect.width(), d_data->thermoRect.y() + d_data->thermoRect.height() - tval); } } } // // paint thermometer // const QColor bgColor = #if QT_VERSION < 0x040000 colorGroup().color(QColorGroup::Background); #else palette().color(QPalette::Background); #endif painter->fillRect(bRect, bgColor); if (alarm) painter->fillRect(aRect, d_data->alarmBrush); painter->fillRect(fRect, d_data->fillBrush); }
const QBrush& QwtThermo::fillBrush | ( | ) | const |
const QColor& QwtThermo::fillColor | ( | ) | const |
void QwtThermo::fontChange | ( | const QFont & | oldFont ) | [protected, virtual] |
Notify a font change.
Definition at line 472 of file qwt_thermo.cpp.
References layoutThermo().
{ QWidget::fontChange( f ); layoutThermo(); }
void QwtThermo::layoutThermo | ( | bool | update_geometry = true ) |
[protected] |
Recalculate the QwtThermo geometry and layout based on the QwtThermo::rect() and the fonts.
update_geometry | notify the layout system and call update to redraw the scale |
Definition at line 266 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::borderWidth, QwtScaleDraw::BottomScale, BottomScale, QwtScaleDraw::getBorderDistHint(), QwtScaleDraw::LeftScale, LeftScale, QwtThermo::PrivateData::map, QwtScaleDraw::move(), NoScale, QwtThermo::PrivateData::orientation, qwtMax, QwtScaleDraw::RightScale, RightScale, QwtThermo::PrivateData::scaleDist, scaleDraw(), QwtThermo::PrivateData::scalePos, QwtScaleDraw::setAlignment(), QwtScaleDraw::setLength(), QwtScaleMap::setPaintInterval(), QwtThermo::PrivateData::thermoRect, QwtThermo::PrivateData::thermoWidth, QwtScaleDraw::TopScale, and TopScale.
Referenced by fontChange(), resizeEvent(), scaleChange(), setBorderWidth(), setOrientation(), setPipeWidth(), and setRange().
{ QRect r = rect(); int mbd = 0; if ( d_data->scalePos != NoScale ) { int d1, d2; scaleDraw()->getBorderDistHint(font(), d1, d2); mbd = qwtMax(d1, d2); } if ( d_data->orientation == Qt::Horizontal ) { switch ( d_data->scalePos ) { case TopScale: { d_data->thermoRect.setRect( r.x() + mbd + d_data->borderWidth, r.y() + r.height() - d_data->thermoWidth - 2*d_data->borderWidth, r.width() - 2*(d_data->borderWidth + mbd), d_data->thermoWidth); scaleDraw()->setAlignment(QwtScaleDraw::TopScale); scaleDraw()->move( d_data->thermoRect.x(), d_data->thermoRect.y() - d_data->borderWidth - d_data->scaleDist); scaleDraw()->setLength(d_data->thermoRect.width()); break; } case BottomScale: case NoScale: // like Bottom but without scale default: // inconsistent orientation and scale position // Mapping between values and pixels requires // initialization of the scale geometry { d_data->thermoRect.setRect( r.x() + mbd + d_data->borderWidth, r.y() + d_data->borderWidth, r.width() - 2*(d_data->borderWidth + mbd), d_data->thermoWidth); scaleDraw()->setAlignment(QwtScaleDraw::BottomScale); scaleDraw()->move( d_data->thermoRect.x(), d_data->thermoRect.y() + d_data->thermoRect.height() + d_data->borderWidth + d_data->scaleDist ); scaleDraw()->setLength(d_data->thermoRect.width()); break; } } d_data->map.setPaintInterval(d_data->thermoRect.x(), d_data->thermoRect.x() + d_data->thermoRect.width() - 1); } else // Qt::Vertical { switch ( d_data->scalePos ) { case RightScale: { d_data->thermoRect.setRect( r.x() + d_data->borderWidth, r.y() + mbd + d_data->borderWidth, d_data->thermoWidth, r.height() - 2*(d_data->borderWidth + mbd)); scaleDraw()->setAlignment(QwtScaleDraw::RightScale); scaleDraw()->move( d_data->thermoRect.x() + d_data->thermoRect.width() + d_data->borderWidth + d_data->scaleDist, d_data->thermoRect.y()); scaleDraw()->setLength(d_data->thermoRect.height()); break; } case LeftScale: case NoScale: // like Left but without scale default: // inconsistent orientation and scale position // Mapping between values and pixels requires // initialization of the scale geometry { d_data->thermoRect.setRect( r.x() + r.width() - 2*d_data->borderWidth - d_data->thermoWidth, r.y() + mbd + d_data->borderWidth, d_data->thermoWidth, r.height() - 2*(d_data->borderWidth + mbd)); scaleDraw()->setAlignment(QwtScaleDraw::LeftScale); scaleDraw()->move( d_data->thermoRect.x() - d_data->scaleDist - d_data->borderWidth, d_data->thermoRect.y() ); scaleDraw()->setLength(d_data->thermoRect.height()); break; } } d_data->map.setPaintInterval( d_data->thermoRect.y() + d_data->thermoRect.height() - 1, d_data->thermoRect.y()); } if ( update_geometry ) { updateGeometry(); update(); } }
double QwtThermo::maxValue | ( | ) | const |
QSize QwtThermo::minimumSizeHint | ( | ) | const [virtual] |
Return a minimum size hint.
Definition at line 879 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::borderWidth, QwtScaleDraw::extent(), QwtScaleDraw::minLength(), NoScale, QwtThermo::PrivateData::orientation, QwtThermo::PrivateData::scaleDist, scaleDraw(), QwtThermo::PrivateData::scalePos, and QwtThermo::PrivateData::thermoWidth.
Referenced by sizeHint().
{ int w = 0, h = 0; if ( d_data->scalePos != NoScale ) { const int sdExtent = scaleDraw()->extent( QPen(), font() ); const int sdLength = scaleDraw()->minLength( QPen(), font() ); w = sdLength; h = d_data->thermoWidth + sdExtent + d_data->borderWidth + d_data->scaleDist; } else // no scale { w = 200; h = d_data->thermoWidth; } if ( d_data->orientation == Qt::Vertical ) qSwap(w, h); w += 2 * d_data->borderWidth; h += 2 * d_data->borderWidth; return QSize( w, h ); }
double QwtThermo::minValue | ( | ) | const |
void QwtThermo::paintEvent | ( | QPaintEvent * | event ) | [protected, virtual] |
Qt paint event. event Paint event
Definition at line 203 of file qwt_thermo.cpp.
References draw(), and QwtPaintBuffer::painter().
{ // Use double-buffering const QRect &ur = event->rect(); if ( ur.isValid() ) { #if QT_VERSION < 0x040000 QwtPaintBuffer paintBuffer(this, ur); draw(paintBuffer.painter(), ur); #else QPainter painter(this); draw(&painter, ur); #endif } }
int QwtThermo::pipeWidth | ( | ) | const |
void QwtThermo::resizeEvent | ( | QResizeEvent * | e ) | [protected, virtual] |
Qt resize event handler.
Definition at line 254 of file qwt_thermo.cpp.
References layoutThermo().
{ layoutThermo( false ); }
void QwtThermo::scaleChange | ( | ) | [protected, virtual] |
Notify a scale change.
Reimplemented from QwtAbstractScale.
Definition at line 479 of file qwt_thermo.cpp.
References layoutThermo().
{ update(); layoutThermo(); }
QwtScaleDraw * QwtThermo::scaleDraw | ( | ) | [protected] |
Definition at line 194 of file qwt_thermo.cpp.
References QwtAbstractScale::abstractScaleDraw().
{ return (QwtScaleDraw *)abstractScaleDraw(); }
const QwtScaleDraw * QwtThermo::scaleDraw | ( | ) | const |
Definition at line 185 of file qwt_thermo.cpp.
References QwtAbstractScale::abstractScaleDraw().
Referenced by draw(), layoutThermo(), and minimumSizeHint().
{ return (QwtScaleDraw *)abstractScaleDraw(); }
ScalePos QwtThermo::scalePosition | ( | ) | const |
void QwtThermo::setAlarmBrush | ( | const QBrush & | brush ) |
Specify the liquid brush above the alarm threshold.
brush | New brush. The default is solid white. |
Definition at line 752 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::alarmBrush.
{ d_data->alarmBrush = brush; update(); }
void QwtThermo::setAlarmColor | ( | const QColor & | c ) |
Specify the liquid color above the alarm threshold.
c | New color. The default is white. |
Definition at line 771 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::alarmBrush.
{ d_data->alarmBrush.setColor(c); update(); }
void QwtThermo::setAlarmEnabled | ( | bool | tf ) |
Enable or disable the alarm threshold.
tf | true (disabled) or false (enabled) |
Definition at line 853 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::alarmEnabled.
{ d_data->alarmEnabled = tf; update(); }
void QwtThermo::setAlarmLevel | ( | double | level ) |
Specify the alarm threshold.
level | Alarm threshold |
Definition at line 789 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::alarmEnabled, and QwtThermo::PrivateData::alarmLevel.
{ d_data->alarmLevel = level; d_data->alarmEnabled = 1; update(); }
void QwtThermo::setBorderWidth | ( | int | width ) |
Set the border width of the pipe.
width | Border width |
Definition at line 657 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::borderWidth, layoutThermo(), qwtMin, and QwtThermo::PrivateData::thermoRect.
{ if ((width >= 0) && (width < (qwtMin(d_data->thermoRect.width(), d_data->thermoRect.height()) + d_data->borderWidth) / 2 - 1)) { d_data->borderWidth = width; layoutThermo(); } }
void QwtThermo::setFillBrush | ( | const QBrush & | brush ) |
Change the brush of the liquid.
brush | New brush. The default brush is solid black. |
Definition at line 712 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::fillBrush.
{ d_data->fillBrush = brush; update(); }
void QwtThermo::setFillColor | ( | const QColor & | c ) |
Change the color of the liquid.
c | New color. The default color is black. |
Definition at line 732 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::fillBrush.
{ d_data->fillBrush.setColor(c); update(); }
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.
m | New Margin. The default values are 10 for horizontal orientation and 20 for vertical orientation. |
Definition at line 844 of file qwt_thermo.cpp.
{ }
void QwtThermo::setMaxValue | ( | double | max ) |
Set the maximum value.
max | Maximum value |
Definition at line 116 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::minValue, and setRange().
void QwtThermo::setMinValue | ( | double | min ) |
Set the minimum value.
min | Minimum value |
Definition at line 133 of file qwt_thermo.cpp.
References QwtThermo::PrivateData::maxValue, and setRange().
void QwtThermo::setOrientation | ( | Qt::Orientation | o, |
ScalePos | s | ||
) |
Set the thermometer orientation and the scale position.
The scale position NoScale disables the scale.
o | orientation. Possible values are Qt::Horizontal and Qt::Vertical. The default value is Qt::Vertical. |
s | Position of the scale. The default value is NoScale. |
A valid combination of scale position and orientation is enforced:
Definition at line 389 of file qwt_thermo.cpp.
References BottomScale, layoutThermo(), LeftScale, NoScale, QwtThermo::PrivateData::orientation, RightScale, QwtThermo::PrivateData::scalePos, and TopScale.
Referenced by setScalePosition().
{ if ( o == d_data->orientation && s == d_data->scalePos ) return; switch(o) { case Qt::Horizontal: { if ((s == NoScale) || (s == BottomScale) || (s == TopScale)) d_data->scalePos = s; else d_data->scalePos = NoScale; break; } case Qt::Vertical: { if ((s == NoScale) || (s == LeftScale) || (s == RightScale)) d_data->scalePos = s; else d_data->scalePos = NoScale; break; } } if ( o != d_data->orientation ) { #if QT_VERSION >= 0x040000 if ( !testAttribute(Qt::WA_WState_OwnSizePolicy) ) #else if ( !testWState( WState_OwnSizePolicy ) ) #endif { QSizePolicy sp = sizePolicy(); sp.transpose(); setSizePolicy(sp); #if QT_VERSION >= 0x040000 setAttribute(Qt::WA_WState_OwnSizePolicy, false); #else clearWState( WState_OwnSizePolicy ); #endif } } d_data->orientation = o; layoutThermo(); }
void QwtThermo::setPipeWidth | ( | int | width ) |
Change the width of the pipe.
width | Width of the pipe |
Definition at line 811 of file qwt_thermo.cpp.
References layoutThermo(), and QwtThermo::PrivateData::thermoWidth.
{ if (width > 0) { d_data->thermoWidth = width; layoutThermo(); } }
void QwtThermo::setRange | ( | double | vmin, |
double | vmax, | ||
bool | logarithmic = false |
||
) |
Set the range.
vmin | value corresponding lower or left end of the thermometer |
vmax | value corresponding to the upper or right end of the thermometer |
logarithmic | logarithmic mapping, true or false |
Definition at line 682 of file qwt_thermo.cpp.
References QwtAbstractScale::autoScale(), layoutThermo(), QwtThermo::PrivateData::map, QwtThermo::PrivateData::maxValue, QwtThermo::PrivateData::minValue, QwtAbstractScale::rescale(), QwtAbstractScale::scaleEngine(), QwtAbstractScale::setScaleEngine(), QwtScaleMap::setScaleInterval(), and QwtScaleMap::setTransformation().
Referenced by setMaxValue(), and setMinValue().
{ d_data->minValue = vmin; d_data->maxValue = vmax; if ( logarithmic ) setScaleEngine(new QwtLog10ScaleEngine); else setScaleEngine(new QwtLinearScaleEngine); /* There are two different maps, one for the scale, the other for the values. This is confusing and will be changed in the future. TODO ... */ d_data->map.setTransformation(scaleEngine()->transformation()); d_data->map.setScaleInterval(d_data->minValue, d_data->maxValue); if (autoScale()) rescale(d_data->minValue, d_data->maxValue); layoutThermo(); }
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(). |
Definition at line 176 of file qwt_thermo.cpp.
References QwtAbstractScale::setAbstractScaleDraw().
{ setAbstractScaleDraw(scaleDraw); }
void QwtThermo::setScalePosition | ( | ScalePos | scalePos ) |
Change the scale position (and thermometer orientation).
scalePos | Position of the scale. |
A valid combination of scale position and orientation is enforced:
Definition at line 452 of file qwt_thermo.cpp.
References BottomScale, LeftScale, NoScale, QwtThermo::PrivateData::orientation, RightScale, setOrientation(), and TopScale.
{ if ((scalePos == BottomScale) || (scalePos == TopScale)) setOrientation(Qt::Horizontal, scalePos); else if ((scalePos == LeftScale) || (scalePos == RightScale)) setOrientation(Qt::Vertical, scalePos); else setOrientation(d_data->orientation, NoScale); }
void QwtThermo::setValue | ( | double | value ) | [slot] |
Set the current value.
value | New Value |
Definition at line 150 of file qwt_thermo.cpp.
References value(), and QwtThermo::PrivateData::value.
QSize QwtThermo::sizeHint | ( | ) | const [virtual] |
Definition at line 869 of file qwt_thermo.cpp.
References minimumSizeHint().
{ return minimumSizeHint(); }
double QwtThermo::value | ( | ) | const |
Referenced by setValue().
const QBrush & QwtThermo::alarmBrush [read, write] |
Return the liquid brush above the alarm threshold.
Definition at line 75 of file qwt_thermo.h.
const QColor & QwtThermo::alarmColor [read, write] |
Return the liquid color above the alarm threshold.
Definition at line 76 of file qwt_thermo.h.
bool QwtThermo::alarmEnabled [read, write] |
Return if the alarm threshold is enabled or disabled.
Definition at line 77 of file qwt_thermo.h.
double QwtThermo::alarmLevel [read, write] |
int QwtThermo::borderWidth [read, write] |
Return the border width of the thermometer pipe.
Definition at line 81 of file qwt_thermo.h.
const QBrush & QwtThermo::fillBrush [read, write] |
const QColor & QwtThermo::fillColor [read, write] |
double QwtThermo::maxValue [read, write] |
Return the maximum value.
Definition at line 84 of file qwt_thermo.h.
double QwtThermo::minValue [read, write] |
Return the minimum value.
Definition at line 85 of file qwt_thermo.h.
int QwtThermo::pipeWidth [read, write] |
QwtThermo::ScalePos QwtThermo::scalePosition [read, write] |
double QwtThermo::value [read, write] |
Return the value.
Definition at line 87 of file qwt_thermo.h.