Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_thermo.cpp
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#include "qwt_thermo.h"
11#include "qwt_scale_draw.h"
12#include "qwt_scale_map.h"
13#include "qwt_color_map.h"
14#include "qwt_math.h"
15
16#include <qpainter.h>
17#include <qevent.h>
18#include <qdrawutil.h>
19#include <qstyle.h>
20#include <qstyleoption.h>
21#include <qmargins.h>
22
23#include <algorithm>
24#include <functional>
25
26 static inline void qwtDrawLine( QPainter* painter, int pos,
27 const QColor& color, const QRect& pipeRect, const QRect& liquidRect,
28 Qt::Orientation orientation )
29{
30 painter->setPen( color );
31 if ( orientation == Qt::Horizontal )
32 {
33 if ( pos >= liquidRect.left() && pos < liquidRect.right() )
34 painter->drawLine( pos, pipeRect.top(), pos, pipeRect.bottom() );
35 }
36 else
37 {
38 if ( pos >= liquidRect.top() && pos < liquidRect.bottom() )
39 painter->drawLine( pipeRect.left(), pos, pipeRect.right(), pos );
40 }
41}
42
43 static QVector< double > qwtTickList( const QwtScaleDiv& scaleDiv )
44{
45 QVector< double > values;
46
47 double lowerLimit = scaleDiv.interval().minValue();
48 double upperLimit = scaleDiv.interval().maxValue();
49
50 if ( upperLimit < lowerLimit )
51 qSwap( lowerLimit, upperLimit );
52
53 values += lowerLimit;
54
55 for ( int tickType = QwtScaleDiv::MinorTick;
56 tickType < QwtScaleDiv::NTickTypes; tickType++ )
57 {
58 const QList< double > ticks = scaleDiv.ticks( tickType );
59
60 for ( int i = 0; i < ticks.count(); i++ )
61 {
62 const double v = ticks[i];
63 if ( v > lowerLimit && v < upperLimit )
64 values += v;
65 }
66 }
67
68 values += upperLimit;
69
70 return values;
71}
72
73 class QwtThermo::PrivateData
74{
75 public:
76 PrivateData()
77 : orientation( Qt::Vertical )
78 , scalePosition( QwtThermo::TrailingScale )
79 , spacing( 3 )
80 , borderWidth( 2 )
81 , pipeWidth( 10 )
82 , alarmLevel( 0.0 )
83 , alarmEnabled( false )
84 , autoFillPipe( true )
85 , originMode( QwtThermo::OriginMinimum )
86 , origin( 0.0 )
87 , colorMap( NULL )
88 , value( 0.0 )
89 {
90 rangeFlags = QwtInterval::IncludeBorders;
91 }
92
93 ~PrivateData()
94 {
95 delete colorMap;
96 }
97
98 Qt::Orientation orientation;
99 QwtThermo::ScalePosition scalePosition;
100
101 int spacing;
102 int borderWidth;
103 int pipeWidth;
104
105 QwtInterval::BorderFlags rangeFlags;
106 double alarmLevel;
107 bool alarmEnabled;
108 bool autoFillPipe;
109 QwtThermo::OriginMode originMode;
110 double origin;
111
112 QwtColorMap* colorMap;
113
114 double value;
115};
116
121 QwtThermo::QwtThermo( QWidget* parent )
122 : QwtAbstractScale( parent )
123{
124 m_data = new PrivateData;
125
126 QSizePolicy policy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
127 if ( m_data->orientation == Qt::Vertical )
128 policy.transpose();
129
130 setSizePolicy( policy );
131
132 setAttribute( Qt::WA_WState_OwnSizePolicy, false );
133 layoutThermo( true );
134}
135
137 QwtThermo::~QwtThermo()
138{
139 delete m_data;
140}
141
157 void QwtThermo::setRangeFlags( QwtInterval::BorderFlags flags )
158{
159 if ( m_data->rangeFlags != flags )
160 {
161 m_data->rangeFlags = flags;
162 update();
163 }
164}
165
170 QwtInterval::BorderFlags QwtThermo::rangeFlags() const
171{
172 return m_data->rangeFlags;
173}
174
181 void QwtThermo::setValue( double value )
182{
183 if ( m_data->value != value )
184 {
185 m_data->value = value;
186 update();
187 }
188}
189
191 double QwtThermo::value() const
192{
193 return m_data->value;
194}
195
207 void QwtThermo::setScaleDraw( QwtScaleDraw* scaleDraw )
208{
209 setAbstractScaleDraw( scaleDraw );
210 layoutThermo( true );
211}
212
217 const QwtScaleDraw* QwtThermo::scaleDraw() const
218{
219 return static_cast< const QwtScaleDraw* >( abstractScaleDraw() );
220}
221
226 QwtScaleDraw* QwtThermo::scaleDraw()
227{
228 return static_cast< QwtScaleDraw* >( abstractScaleDraw() );
229}
230
235 void QwtThermo::paintEvent( QPaintEvent* event )
236{
237 QPainter painter( this );
238 painter.setClipRegion( event->region() );
239
240 QStyleOption opt;
241 opt.initFrom(this);
242 style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
243
244 const QRect tRect = pipeRect();
245
246 if ( !tRect.contains( event->rect() ) )
247 {
248 if ( m_data->scalePosition != QwtThermo::NoScale )
249 scaleDraw()->draw( &painter, palette() );
250 }
251
252 const int bw = m_data->borderWidth;
253
254 const QBrush brush = palette().brush( QPalette::Base );
255 qDrawShadePanel( &painter,
256 tRect.adjusted( -bw, -bw, bw, bw ),
257 palette(), true, bw,
258 m_data->autoFillPipe ? &brush : NULL );
259
260 drawLiquid( &painter, tRect );
261}
262
267 void QwtThermo::resizeEvent( QResizeEvent* event )
268{
269 Q_UNUSED( event );
270 layoutThermo( false );
271}
272
277 void QwtThermo::changeEvent( QEvent* event )
278{
279 switch( event->type() )
280 {
281 case QEvent::StyleChange:
282 case QEvent::FontChange:
283 {
284 layoutThermo( true );
285 break;
286 }
287 default:
288 break;
289 }
290}
291
299 void QwtThermo::layoutThermo( bool update_geometry )
300{
301 const QRect tRect = pipeRect();
302 const int bw = m_data->borderWidth + m_data->spacing;
303 const bool inverted = ( upperBound() < lowerBound() );
304
305 int from, to;
306
307 if ( m_data->orientation == Qt::Horizontal )
308 {
309 from = tRect.left();
310 to = tRect.right();
311
312 if ( m_data->rangeFlags & QwtInterval::ExcludeMinimum )
313 {
314 if ( inverted )
315 to++;
316 else
317 from--;
318 }
319 if ( m_data->rangeFlags & QwtInterval::ExcludeMaximum )
320 {
321 if ( inverted )
322 from--;
323 else
324 to++;
325 }
326
327 if ( m_data->scalePosition == QwtThermo::TrailingScale )
328 {
329 scaleDraw()->setAlignment( QwtScaleDraw::TopScale );
330 scaleDraw()->move( from, tRect.top() - bw );
331 }
332 else
333 {
334 scaleDraw()->setAlignment( QwtScaleDraw::BottomScale );
335 scaleDraw()->move( from, tRect.bottom() + bw );
336 }
337
338 scaleDraw()->setLength( qMax( to - from, 0 ) );
339 }
340 else // Qt::Vertical
341 {
342 from = tRect.top();
343 to = tRect.bottom();
344
345 if ( m_data->rangeFlags & QwtInterval::ExcludeMinimum )
346 {
347 if ( inverted )
348 from--;
349 else
350 to++;
351 }
352 if ( m_data->rangeFlags & QwtInterval::ExcludeMaximum )
353 {
354 if ( inverted )
355 to++;
356 else
357 from--;
358 }
359
360 if ( m_data->scalePosition == QwtThermo::LeadingScale )
361 {
362 scaleDraw()->setAlignment( QwtScaleDraw::RightScale );
363 scaleDraw()->move( tRect.right() + bw, from );
364 }
365 else
366 {
367 scaleDraw()->setAlignment( QwtScaleDraw::LeftScale );
368 scaleDraw()->move( tRect.left() - bw, from );
369 }
370
371 scaleDraw()->setLength( qMax( to - from, 0 ) );
372 }
373
374 if ( update_geometry )
375 {
376 updateGeometry();
377 update();
378 }
379}
380
385QRect QwtThermo::pipeRect() const
386{
387 int mbd = 0;
388 if ( m_data->scalePosition != QwtThermo::NoScale )
389 {
390 int d1, d2;
391 scaleDraw()->getBorderDistHint( font(), d1, d2 );
392 mbd = qMax( d1, d2 );
393 }
394 const int bw = m_data->borderWidth;
395 const int scaleOff = bw + mbd;
396
397 const QRect cr = contentsRect();
398
399 QRect pipeRect = cr;
400 if ( m_data->orientation == Qt::Horizontal )
401 {
402 pipeRect.adjust( scaleOff, 0, -scaleOff, 0 );
403
404 if ( m_data->scalePosition == QwtThermo::TrailingScale )
405 pipeRect.setTop( cr.top() + cr.height() - bw - m_data->pipeWidth );
406 else
407 pipeRect.setTop( bw );
408
409 pipeRect.setHeight( m_data->pipeWidth );
410 }
411 else // Qt::Vertical
412 {
413 pipeRect.adjust( 0, scaleOff, 0, -scaleOff );
414
415 if ( m_data->scalePosition == QwtThermo::LeadingScale )
416 pipeRect.setLeft( bw );
417 else
418 pipeRect.setLeft( cr.left() + cr.width() - bw - m_data->pipeWidth );
419
420 pipeRect.setWidth( m_data->pipeWidth );
421 }
422
423 return pipeRect;
424}
425
432 void QwtThermo::setOrientation( Qt::Orientation orientation )
433{
434 if ( orientation == m_data->orientation )
435 return;
436
437 m_data->orientation = orientation;
438
439 if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
440 {
441 QSizePolicy sp = sizePolicy();
442 sp.transpose();
443 setSizePolicy( sp );
444
445 setAttribute( Qt::WA_WState_OwnSizePolicy, false );
446 }
447
448 layoutThermo( true );
449}
450
455Qt::Orientation QwtThermo::orientation() const
456{
457 return m_data->orientation;
458}
459
464 void QwtThermo::setOriginMode( OriginMode m )
465{
466 if ( m == m_data->originMode )
467 return;
468
469 m_data->originMode = m;
470 update();
471}
472
477 QwtThermo::OriginMode QwtThermo::originMode() const
478{
479 return m_data->originMode;
480}
481
491 void QwtThermo::setOrigin( double origin )
492{
493 if ( origin == m_data->origin )
494 return;
495
496 m_data->origin = origin;
497 update();
498}
499
504 double QwtThermo::origin() const
505{
506 return m_data->origin;
507}
508
515 void QwtThermo::setScalePosition( ScalePosition scalePosition )
516{
517 if ( m_data->scalePosition == scalePosition )
518 return;
519
520 m_data->scalePosition = scalePosition;
521
522 if ( testAttribute( Qt::WA_WState_Polished ) )
523 layoutThermo( true );
524}
525
530 QwtThermo::ScalePosition QwtThermo::scalePosition() const
531{
532 return m_data->scalePosition;
533}
534
536 void QwtThermo::scaleChange()
537{
538 layoutThermo( true );
539}
540
546 void QwtThermo::drawLiquid(
547 QPainter* painter, const QRect& pipeRect ) const
548{
549 painter->save();
550 painter->setClipRect( pipeRect, Qt::IntersectClip );
551 painter->setPen( Qt::NoPen );
552
553 const QwtScaleMap scaleMap = scaleDraw()->scaleMap();
554
555 QRect liquidRect = fillRect( pipeRect );
556
557 if ( m_data->colorMap != NULL )
558 {
559 const QwtInterval interval = scaleDiv().interval().normalized();
560
561 // Because the positions of the ticks are rounded
562 // we calculate the colors for the rounded tick values
563
564 QVector< double > values = qwtTickList( scaleDraw()->scaleDiv() );
565
566 if ( scaleMap.isInverting() )
567 std::sort( values.begin(), values.end(), std::greater< double >() );
568 else
569 std::sort( values.begin(), values.end(), std::less< double >() );
570
571 int from;
572 if ( !values.isEmpty() )
573 {
574 from = qRound( scaleMap.transform( values[0] ) );
575 qwtDrawLine( painter, from,
576 m_data->colorMap->color( interval, values[0] ),
577 pipeRect, liquidRect, m_data->orientation );
578 }
579
580 for ( int i = 1; i < values.size(); i++ )
581 {
582 const int to = qRound( scaleMap.transform( values[i] ) );
583
584 for ( int pos = from + 1; pos < to; pos++ )
585 {
586 const double v = scaleMap.invTransform( pos );
587
588 qwtDrawLine( painter, pos,
589 m_data->colorMap->color( interval, v ),
590 pipeRect, liquidRect, m_data->orientation );
591 }
592
593 qwtDrawLine( painter, to,
594 m_data->colorMap->color( interval, values[i] ),
595 pipeRect, liquidRect, m_data->orientation );
596
597 from = to;
598 }
599 }
600 else
601 {
602 if ( !liquidRect.isEmpty() && m_data->alarmEnabled )
603 {
604 const QRect r = alarmRect( liquidRect );
605 if ( !r.isEmpty() )
606 {
607 painter->fillRect( r, palette().brush( QPalette::Highlight ) );
608 liquidRect = QRegion( liquidRect ).subtracted( r ).boundingRect();
609 }
610 }
611
612 painter->fillRect( liquidRect, palette().brush( QPalette::ButtonText ) );
613 }
614
615 painter->restore();
616}
617
629 void QwtThermo::setSpacing( int spacing )
630{
631 if ( spacing <= 0 )
632 spacing = 0;
633
634 if ( spacing != m_data->spacing )
635 {
636 m_data->spacing = spacing;
637 layoutThermo( true );
638 }
639}
640
645 int QwtThermo::spacing() const
646{
647 return m_data->spacing;
648}
649
655 void QwtThermo::setBorderWidth( int width )
656{
657 if ( width <= 0 )
658 width = 0;
659
660 if ( width != m_data->borderWidth )
661 {
662 m_data->borderWidth = width;
663 layoutThermo( true );
664 }
665}
666
671 int QwtThermo::borderWidth() const
672{
673 return m_data->borderWidth;
674}
675
683 void QwtThermo::setColorMap( QwtColorMap* colorMap )
684{
685 if ( colorMap != m_data->colorMap )
686 {
687 delete m_data->colorMap;
688 m_data->colorMap = colorMap;
689 }
690}
691
697 QwtColorMap* QwtThermo::colorMap()
698{
699 return m_data->colorMap;
700}
701
707 const QwtColorMap* QwtThermo::colorMap() const
708{
709 return m_data->colorMap;
710}
711
720 void QwtThermo::setFillBrush( const QBrush& brush )
721{
722 QPalette pal = palette();
723 pal.setBrush( QPalette::ButtonText, brush );
724 setPalette( pal );
725}
726
731QBrush QwtThermo::fillBrush() const
732{
733 return palette().brush( QPalette::ButtonText );
734}
735
747 void QwtThermo::setAlarmBrush( const QBrush& brush )
748{
749 QPalette pal = palette();
750 pal.setBrush( QPalette::Highlight, brush );
751 setPalette( pal );
752}
753
761QBrush QwtThermo::alarmBrush() const
762{
763 return palette().brush( QPalette::Highlight );
764}
765
775 void QwtThermo::setAlarmLevel( double level )
776{
777 m_data->alarmLevel = level;
778 m_data->alarmEnabled = 1;
779 update();
780}
781
789 double QwtThermo::alarmLevel() const
790{
791 return m_data->alarmLevel;
792}
793
800 void QwtThermo::setPipeWidth( int width )
801{
802 if ( width > 0 )
803 {
804 m_data->pipeWidth = width;
805 layoutThermo( true );
806 }
807}
808
813 int QwtThermo::pipeWidth() const
814{
815 return m_data->pipeWidth;
816}
817
825 void QwtThermo::setAlarmEnabled( bool on )
826{
827 m_data->alarmEnabled = on;
828 update();
829}
830
837 bool QwtThermo::alarmEnabled() const
838{
839 return m_data->alarmEnabled;
840}
841
846QSize QwtThermo::sizeHint() const
847{
848 return minimumSizeHint();
849}
850
856QSize QwtThermo::minimumSizeHint() const
857{
858 int w = 0, h = 0;
859
860 if ( m_data->scalePosition != NoScale )
861 {
862 const int sdExtent = qwtCeil( scaleDraw()->extent( font() ) );
863 const int sdLength = scaleDraw()->minLength( font() );
864
865 w = sdLength;
866 h = m_data->pipeWidth + sdExtent + m_data->spacing;
867
868 }
869 else // no scale
870 {
871 w = 200;
872 h = m_data->pipeWidth;
873 }
874
875 if ( m_data->orientation == Qt::Vertical )
876 qSwap( w, h );
877
878 w += 2 * m_data->borderWidth;
879 h += 2 * m_data->borderWidth;
880
881 // finally add the margins
882 const QMargins m = contentsMargins();
883 w += m.left() + m.right();
884 h += m.top() + m.bottom();
885
886 return QSize( w, h );
887}
888
897QRect QwtThermo::fillRect( const QRect& pipeRect ) const
898{
899 double origin;
900 if ( m_data->originMode == OriginMinimum )
901 {
902 origin = qMin( lowerBound(), upperBound() );
903 }
904 else if ( m_data->originMode == OriginMaximum )
905 {
906 origin = qMax( lowerBound(), upperBound() );
907 }
908 else // OriginCustom
909 {
910 origin = m_data->origin;
911 }
912
913 const QwtScaleMap scaleMap = scaleDraw()->scaleMap();
914
915 int from = qRound( scaleMap.transform( m_data->value ) );
916 int to = qRound( scaleMap.transform( origin ) );
917
918 if ( to < from )
919 qSwap( from, to );
920
921 QRect fillRect = pipeRect;
922 if ( m_data->orientation == Qt::Horizontal )
923 {
924 fillRect.setLeft( from );
925 fillRect.setRight( to );
926 }
927 else // Qt::Vertical
928 {
929 fillRect.setTop( from );
930 fillRect.setBottom( to );
931 }
932
933 return fillRect.normalized();
934}
935
944QRect QwtThermo::alarmRect( const QRect& fillRect ) const
945{
946 QRect alarmRect( 0, 0, -1, -1); // something invalid
947
948 if ( !m_data->alarmEnabled )
949 return alarmRect;
950
951 const bool inverted = ( upperBound() < lowerBound() );
952
953 bool increasing;
954 if ( m_data->originMode == OriginCustom )
955 {
956 increasing = m_data->value > m_data->origin;
957 }
958 else
959 {
960 increasing = m_data->originMode == OriginMinimum;
961 }
962
963 const QwtScaleMap map = scaleDraw()->scaleMap();
964 const int alarmPos = qRound( map.transform( m_data->alarmLevel ) );
965 const int valuePos = qRound( map.transform( m_data->value ) );
966
967 if ( m_data->orientation == Qt::Horizontal )
968 {
969 int v1, v2;
970 if ( inverted )
971 {
972 v1 = fillRect.left();
973
974 v2 = alarmPos - 1;
975 v2 = qMin( v2, increasing ? fillRect.right() : valuePos );
976 }
977 else
978 {
979 v1 = alarmPos + 1;
980 v1 = qMax( v1, increasing ? fillRect.left() : valuePos );
981
982 v2 = fillRect.right();
983
984 }
985 alarmRect.setRect( v1, fillRect.top(), v2 - v1 + 1, fillRect.height() );
986 }
987 else
988 {
989 int v1, v2;
990 if ( inverted )
991 {
992 v1 = alarmPos + 1;
993 v1 = qMax( v1, increasing ? fillRect.top() : valuePos );
994
995 v2 = fillRect.bottom();
996 }
997 else
998 {
999 v1 = fillRect.top();
1000
1001 v2 = alarmPos - 1;
1002 v2 = qMin( v2, increasing ? fillRect.bottom() : valuePos );
1003 }
1004 alarmRect.setRect( fillRect.left(), v1, fillRect.width(), v2 - v1 + 1 );
1005 }
1006
1007 return alarmRect;
1008}
1009
1010#include "moc_qwt_thermo.cpp"
QList< double >
QVector< double >
QwtAbstractScaleDraw::scaleMap
const QwtScaleMap & scaleMap() const
Definition qwt_abstract_scale_draw.cpp:121
QwtAbstractScaleDraw::draw
virtual void draw(QPainter *, const QPalette &) const
Draw the scale.
Definition qwt_abstract_scale_draw.cpp:169
QwtAbstractScale
An abstract base class for widgets having a scale.
Definition qwt_abstract_scale.h:37
QwtAbstractScale::scaleMap
const QwtScaleMap & scaleMap() const
Definition qwt_abstract_scale.cpp:357
QwtAbstractScale::lowerBound
double lowerBound() const
Definition qwt_abstract_scale.cpp:88
QwtAbstractScale::abstractScaleDraw
const QwtAbstractScaleDraw * abstractScaleDraw() const
Definition qwt_abstract_scale.cpp:302
QwtAbstractScale::scaleDiv
const QwtScaleDiv & scaleDiv() const
Definition qwt_abstract_scale.cpp:349
QwtAbstractScale::setAbstractScaleDraw
void setAbstractScaleDraw(QwtAbstractScaleDraw *)
Set a scale draw.
Definition qwt_abstract_scale.cpp:277
QwtAbstractScale::upperBound
double upperBound() const
Definition qwt_abstract_scale.cpp:111
QwtColorMap
QwtColorMap is used to map values into colors.
Definition qwt_color_map.h:38
QwtColorMap::color
QColor color(const QwtInterval &, double value) const
Definition qwt_color_map.h:248
QwtInterval
A class representing an interval.
Definition qwt_interval.h:23
QwtInterval::minValue
double minValue() const
Definition qwt_interval.h:192
QwtInterval::normalized
QwtInterval normalized() const
Normalize the limits of the interval.
Definition qwt_interval.cpp:29
QwtInterval::ExcludeMaximum
@ ExcludeMaximum
Max value is not included in the interval.
Definition qwt_interval.h:38
QwtInterval::ExcludeMinimum
@ ExcludeMinimum
Min value is not included in the interval.
Definition qwt_interval.h:35
QwtInterval::IncludeBorders
@ IncludeBorders
Min/Max values are inside the interval.
Definition qwt_interval.h:32
QwtInterval::maxValue
double maxValue() const
Definition qwt_interval.h:198
QwtInterval::BorderFlags
QFlags< BorderFlag > BorderFlags
Border flags.
Definition qwt_interval.h:45
QwtScaleDiv
A class representing a scale division.
Definition qwt_scale_div.h:34
QwtScaleDiv::interval
QwtInterval interval() const
Definition qwt_scale_div.cpp:111
QwtScaleDiv::ticks
QList< double > ticks(int tickType) const
Definition qwt_scale_div.cpp:309
QwtScaleDiv::MinorTick
@ MinorTick
Minor ticks.
Definition qwt_scale_div.h:43
QwtScaleDiv::NTickTypes
@ NTickTypes
Number of valid tick types.
Definition qwt_scale_div.h:52
QwtScaleDraw
A class for drawing scales.
Definition qwt_scale_draw.h:36
QwtScaleDraw::setLength
void setLength(double length)
Definition qwt_scale_draw.cpp:732
QwtScaleDraw::move
void move(double x, double y)
Definition qwt_scale_draw.h:118
QwtScaleDraw::getBorderDistHint
void getBorderDistHint(const QFont &, int &start, int &end) const
Determine the minimum border distance.
Definition qwt_scale_draw.cpp:361
QwtScaleDraw::minLength
int minLength(const QFont &) const
Definition qwt_scale_draw.cpp:560
QwtScaleDraw::setAlignment
void setAlignment(Alignment)
Definition qwt_scale_draw.cpp:322
QwtScaleDraw::BottomScale
@ BottomScale
The scale is below.
Definition qwt_scale_draw.h:45
QwtScaleDraw::TopScale
@ TopScale
The scale is above.
Definition qwt_scale_draw.h:48
QwtScaleDraw::RightScale
@ RightScale
The scale is right.
Definition qwt_scale_draw.h:54
QwtScaleDraw::LeftScale
@ LeftScale
The scale is left.
Definition qwt_scale_draw.h:51
QwtScaleMap
A scale map.
Definition qwt_scale_map.h:27
QwtScaleMap::isInverting
bool isInverting() const
Definition qwt_scale_map.h:164
QwtScaleMap::transform
double transform(double s) const
Definition qwt_scale_map.h:137
QwtScaleMap::invTransform
double invTransform(double p) const
Definition qwt_scale_map.h:154
QwtThermo
The Thermometer Widget.
Definition qwt_thermo.h:47
QwtThermo::setOrigin
void setOrigin(double)
Specifies the custom origin.
Definition qwt_thermo.cpp:491
QwtThermo::setScalePosition
void setScalePosition(ScalePosition)
Change the position of the scale.
Definition qwt_thermo.cpp:515
QwtThermo::setAlarmEnabled
void setAlarmEnabled(bool)
Enable or disable the alarm threshold.
Definition qwt_thermo.cpp:825
QwtThermo::setAlarmLevel
void setAlarmLevel(double)
Definition qwt_thermo.cpp:775
QwtThermo::resizeEvent
virtual void resizeEvent(QResizeEvent *) override
Definition qwt_thermo.cpp:267
QwtThermo::pipeRect
QRect pipeRect() const
Definition qwt_thermo.cpp:385
QwtThermo::spacing
int spacing() const
Definition qwt_thermo.cpp:645
QwtThermo::QwtThermo
QwtThermo(QWidget *parent=NULL)
Definition qwt_thermo.cpp:121
QwtThermo::setValue
virtual void setValue(double)
Definition qwt_thermo.cpp:181
QwtThermo::setPipeWidth
void setPipeWidth(int)
Definition qwt_thermo.cpp:800
QwtThermo::scaleDraw
const QwtScaleDraw * scaleDraw() const
Definition qwt_thermo.cpp:217
QwtThermo::setAlarmBrush
void setAlarmBrush(const QBrush &)
Specify the liquid brush above the alarm threshold.
Definition qwt_thermo.cpp:747
QwtThermo::ScalePosition
ScalePosition
Definition qwt_thermo.h:74
QwtThermo::NoScale
@ NoScale
The slider has no scale.
Definition qwt_thermo.h:76
QwtThermo::TrailingScale
@ TrailingScale
The scale is left of a vertical or above of a horizontal slider.
Definition qwt_thermo.h:82
QwtThermo::LeadingScale
@ LeadingScale
The scale is right of a vertical or below of a horizontal slider.
Definition qwt_thermo.h:79
QwtThermo::pipeWidth
int pipeWidth() const
Definition qwt_thermo.cpp:813
QwtThermo::origin
double origin() const
Definition qwt_thermo.cpp:504
QwtThermo::paintEvent
virtual void paintEvent(QPaintEvent *) override
Definition qwt_thermo.cpp:235
QwtThermo::setSpacing
void setSpacing(int)
Change the spacing between pipe and scale.
Definition qwt_thermo.cpp:629
QwtThermo::fillBrush
QBrush fillBrush() const
Definition qwt_thermo.cpp:731
QwtThermo::setBorderWidth
void setBorderWidth(int)
Definition qwt_thermo.cpp:655
QwtThermo::setScaleDraw
void setScaleDraw(QwtScaleDraw *)
Set a scale draw.
Definition qwt_thermo.cpp:207
QwtThermo::colorMap
QwtColorMap * colorMap()
Definition qwt_thermo.cpp:697
QwtThermo::OriginMode
OriginMode
Definition qwt_thermo.h:92
QwtThermo::OriginMaximum
@ OriginMaximum
The origin is the maximum of the scale.
Definition qwt_thermo.h:97
QwtThermo::OriginCustom
@ OriginCustom
The origin is specified using the origin() property.
Definition qwt_thermo.h:100
QwtThermo::OriginMinimum
@ OriginMinimum
The origin is the minimum of the scale.
Definition qwt_thermo.h:94
QwtThermo::setOriginMode
void setOriginMode(OriginMode)
Change how the origin is determined.
Definition qwt_thermo.cpp:464
QwtThermo::rangeFlags
QwtInterval::BorderFlags rangeFlags() const
Definition qwt_thermo.cpp:170
QwtThermo::value
double value() const
Return the value.
Definition qwt_thermo.cpp:191
QwtThermo::alarmBrush
QBrush alarmBrush() const
Definition qwt_thermo.cpp:761
QwtThermo::setRangeFlags
void setRangeFlags(QwtInterval::BorderFlags)
Exclude/Include min/max values.
Definition qwt_thermo.cpp:157
QwtThermo::changeEvent
virtual void changeEvent(QEvent *) override
Definition qwt_thermo.cpp:277
QwtThermo::fillRect
QRect fillRect(const QRect &) const
Calculate the filled rectangle of the pipe.
Definition qwt_thermo.cpp:897
QwtThermo::minimumSizeHint
virtual QSize minimumSizeHint() const override
Definition qwt_thermo.cpp:856
QwtThermo::drawLiquid
virtual void drawLiquid(QPainter *, const QRect &) const
Definition qwt_thermo.cpp:546
QwtThermo::setFillBrush
void setFillBrush(const QBrush &)
Change the brush of the liquid.
Definition qwt_thermo.cpp:720
QwtThermo::~QwtThermo
virtual ~QwtThermo()
Destructor.
Definition qwt_thermo.cpp:137
QwtThermo::setColorMap
void setColorMap(QwtColorMap *)
Assign a color map for the fill color.
Definition qwt_thermo.cpp:683
QwtThermo::borderWidth
int borderWidth() const
Definition qwt_thermo.cpp:671
QwtThermo::alarmEnabled
bool alarmEnabled() const
Definition qwt_thermo.cpp:837
QwtThermo::orientation
Qt::Orientation orientation() const
Definition qwt_thermo.cpp:455
QwtThermo::originMode
OriginMode originMode() const
Definition qwt_thermo.cpp:477
QwtThermo::setOrientation
void setOrientation(Qt::Orientation)
Set the orientation.
Definition qwt_thermo.cpp:432
QwtThermo::scalePosition
ScalePosition scalePosition() const
Definition qwt_thermo.cpp:530
QwtThermo::alarmRect
QRect alarmRect(const QRect &) const
Calculate the alarm rectangle of the pipe.
Definition qwt_thermo.cpp:944
QwtThermo::scaleChange
virtual void scaleChange() override
Notify a scale change.
Definition qwt_thermo.cpp:536
QwtThermo::alarmLevel
double alarmLevel() const
Definition qwt_thermo.cpp:789
QwtThermo::sizeHint
virtual QSize sizeHint() const override
Definition qwt_thermo.cpp:846