Qwt User's Guide  6.1-rc3
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_thermo.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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 #ifndef QWT_THERMO_H
11 #define QWT_THERMO_H
12 
13 #include "qwt_global.h"
14 #include "qwt_abstract_scale.h"
15 #include "qwt_interval.h"
16 
17 class QwtScaleDraw;
18 class QwtColorMap;
19 
46 class QWT_EXPORT QwtThermo: public QwtAbstractScale
47 {
48  Q_OBJECT
49 
50  Q_ENUMS( ScalePos )
51 
52  Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled )
53  Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel )
54  Q_PROPERTY( ScalePos scalePosition READ scalePosition
55  WRITE setScalePosition )
56  Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
57  Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
58  Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth )
59  Q_PROPERTY( double value READ value WRITE setValue )
60 
61 public:
71  enum ScalePos
72  {
75 
78 
81 
84 
86  BottomScale
87  };
88 
89  explicit QwtThermo( QWidget *parent = NULL );
90  virtual ~QwtThermo();
91 
92  void setOrientation( Qt::Orientation, ScalePos );
93 
94  void setScalePosition( ScalePos s );
95  ScalePos scalePosition() const;
96 
97  void setSpacing( int );
98  int spacing() const;
99 
100  void setBorderWidth( int w );
101  int borderWidth() const;
102 
103  void setFillBrush( const QBrush &b );
104  const QBrush &fillBrush() const;
105 
106  void setAlarmBrush( const QBrush &b );
107  const QBrush &alarmBrush() const;
108 
109  void setAlarmLevel( double v );
110  double alarmLevel() const;
111 
112  void setAlarmEnabled( bool tf );
113  bool alarmEnabled() const;
114 
115  void setColorMap( QwtColorMap * );
116  QwtColorMap *colorMap();
117  const QwtColorMap *colorMap() const;
118 
119  void setPipeWidth( int w );
120  int pipeWidth() const;
121 
122  void setRangeFlags( QwtInterval::BorderFlags );
123  QwtInterval::BorderFlags rangeFlags() const;
124 
125  double value() const;
126 
127  virtual QSize sizeHint() const;
128  virtual QSize minimumSizeHint() const;
129 
130  void setScaleDraw( QwtScaleDraw * );
131  const QwtScaleDraw *scaleDraw() const;
132 
133 public Q_SLOTS:
134  virtual void setValue( double val );
135 
136 protected:
137  virtual void drawLiquid( QPainter *, const QRect & ) const;
138  virtual void scaleChange();
139 
140  virtual void paintEvent( QPaintEvent * );
141  virtual void resizeEvent( QResizeEvent * );
142  virtual void changeEvent( QEvent * );
143 
144  QwtScaleDraw *scaleDraw();
145 
146  QRect pipeRect() const;
147 
148 private:
149  void layoutThermo( bool );
150 
151  class PrivateData;
152  PrivateData *d_data;
153 };
154 
155 #endif