Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_THERMO_H
00011 #define QWT_THERMO_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_abstract_scale.h"
00015 #include "qwt_interval.h"
00016
00017 class QwtScaleDraw;
00018 class QwtColorMap;
00019
00046 class QWT_EXPORT QwtThermo: public QwtAbstractScale
00047 {
00048 Q_OBJECT
00049
00050 Q_ENUMS( ScalePosition )
00051 Q_ENUMS( OriginMode )
00052
00053 Q_PROPERTY( Qt::Orientation orientation
00054 READ orientation WRITE setOrientation )
00055 Q_PROPERTY( ScalePosition scalePosition
00056 READ scalePosition WRITE setScalePosition )
00057 Q_PROPERTY( OriginMode originMode READ originMode WRITE setOriginMode )
00058
00059 Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled )
00060 Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel )
00061 Q_PROPERTY( double origin READ origin WRITE setOrigin )
00062 Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
00063 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
00064 Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth )
00065 Q_PROPERTY( double value READ value WRITE setValue USER true )
00066
00067 public:
00068
00073 enum ScalePosition
00074 {
00076 NoScale,
00077
00079 LeadingScale,
00080
00082 TrailingScale
00083 };
00084
00091 enum OriginMode
00092 {
00094 OriginMinimum,
00095
00097 OriginMaximum,
00098
00100 OriginCustom
00101 };
00102
00103 explicit QwtThermo( QWidget *parent = NULL );
00104 virtual ~QwtThermo();
00105
00106 void setOrientation( Qt::Orientation );
00107 Qt::Orientation orientation() const;
00108
00109 void setScalePosition( ScalePosition );
00110 ScalePosition scalePosition() const;
00111
00112 void setSpacing( int );
00113 int spacing() const;
00114
00115 void setBorderWidth( int w );
00116 int borderWidth() const;
00117
00118 void setOriginMode( OriginMode );
00119 OriginMode originMode() const;
00120
00121 void setOrigin( double );
00122 double origin() const;
00123
00124 void setFillBrush( const QBrush &b );
00125 QBrush fillBrush() const;
00126
00127 void setAlarmBrush( const QBrush &b );
00128 QBrush alarmBrush() const;
00129
00130 void setAlarmLevel( double v );
00131 double alarmLevel() const;
00132
00133 void setAlarmEnabled( bool tf );
00134 bool alarmEnabled() const;
00135
00136 void setColorMap( QwtColorMap * );
00137 QwtColorMap *colorMap();
00138 const QwtColorMap *colorMap() const;
00139
00140 void setPipeWidth( int w );
00141 int pipeWidth() const;
00142
00143 void setRangeFlags( QwtInterval::BorderFlags );
00144 QwtInterval::BorderFlags rangeFlags() const;
00145
00146 double value() const;
00147
00148 virtual QSize sizeHint() const;
00149 virtual QSize minimumSizeHint() const;
00150
00151 void setScaleDraw( QwtScaleDraw * );
00152 const QwtScaleDraw *scaleDraw() const;
00153
00154 public Q_SLOTS:
00155 virtual void setValue( double val );
00156
00157 protected:
00158 virtual void drawLiquid( QPainter *, const QRect & ) const;
00159 virtual void scaleChange();
00160
00161 virtual void paintEvent( QPaintEvent * );
00162 virtual void resizeEvent( QResizeEvent * );
00163 virtual void changeEvent( QEvent * );
00164
00165 QwtScaleDraw *scaleDraw();
00166
00167 QRect pipeRect() const;
00168 QRect fillRect( const QRect & ) const;
00169 QRect alarmRect( const QRect & ) const;
00170
00171 private:
00172 void layoutThermo( bool );
00173
00174 class PrivateData;
00175 PrivateData *d_data;
00176 };
00177
00178 #endif