Qwt User's Guide svn
qwt_thermo.h
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
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 #include <qwidget.h>
00017 
00018 class QwtScaleDraw;
00019 class QwtColorMap;
00020 
00083 class QWT_EXPORT QwtThermo: public QWidget, public QwtAbstractScale
00084 {
00085     Q_OBJECT
00086 
00087     Q_ENUMS( ScalePos )
00088 
00089     Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled )
00090     Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel )
00091     Q_PROPERTY( ScalePos scalePosition READ scalePosition
00092         WRITE setScalePosition )
00093     Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
00094     Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
00095     Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue )
00096     Q_PROPERTY( double minValue READ minValue WRITE setMinValue )
00097     Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth )
00098     Q_PROPERTY( double value READ value WRITE setValue )
00099 
00100 public:
00110     enum ScalePos
00111     {
00113         NoScale,
00114 
00116         LeftScale,
00117 
00119         RightScale,
00120 
00122         TopScale,
00123 
00125         BottomScale
00126     };
00127 
00128     explicit QwtThermo( QWidget *parent = NULL );
00129     virtual ~QwtThermo();
00130 
00131     void setOrientation( Qt::Orientation, ScalePos );
00132 
00133     void setScalePosition( ScalePos s );
00134     ScalePos scalePosition() const;
00135 
00136     void setSpacing( int );
00137     int spacing() const;
00138 
00139     void setBorderWidth( int w );
00140     int borderWidth() const;
00141 
00142     void setFillBrush( const QBrush &b );
00143     const QBrush &fillBrush() const;
00144 
00145     void setAlarmBrush( const QBrush &b );
00146     const QBrush &alarmBrush() const;
00147 
00148     void setAlarmLevel( double v );
00149     double alarmLevel() const;
00150 
00151     void setAlarmEnabled( bool tf );
00152     bool alarmEnabled() const;
00153 
00154     void setColorMap( QwtColorMap * );
00155     QwtColorMap *colorMap();
00156     const QwtColorMap *colorMap() const;
00157 
00158     void setPipeWidth( int w );
00159     int pipeWidth() const;
00160 
00161     void setRangeFlags( QwtInterval::BorderFlags );
00162     QwtInterval::BorderFlags rangeFlags() const;
00163 
00164     void setMaxValue( double v );
00165     double maxValue() const;
00166 
00167     void setMinValue( double v );
00168     double minValue() const;
00169 
00170     double value() const;
00171 
00172     void setRange( double vmin, double vmax, bool lg = false );
00173 
00174     virtual QSize sizeHint() const;
00175     virtual QSize minimumSizeHint() const;
00176 
00177     void setScaleDraw( QwtScaleDraw * );
00178     const QwtScaleDraw *scaleDraw() const;
00179 
00180 public Q_SLOTS:
00181     virtual void setValue( double val );
00182 
00183 protected:
00184     virtual void drawLiquid( QPainter *, const QRect & ) const;
00185     virtual void scaleChange();
00186 
00187     virtual void paintEvent( QPaintEvent * );
00188     virtual void resizeEvent( QResizeEvent * );
00189     virtual void changeEvent( QEvent * );
00190 
00191     QwtScaleDraw *scaleDraw();
00192 
00193     QRect pipeRect() const;
00194 
00195 private:
00196     void layoutThermo( bool );
00197 
00198     class PrivateData;
00199     PrivateData *d_data;
00200 };
00201 
00202 #endif
qmi style