source: ntrip/trunk/BNC/qwt/qwt_thermo.h@ 10573

Last change on this file since 10573 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 4.6 KB
RevLine 
[8127]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
17class QwtScaleDraw;
18class QwtColorMap;
19
20/*!
21 \brief The Thermometer Widget
22
23 QwtThermo is a widget which displays a value in an interval. It supports:
24 - a horizontal or vertical layout;
25 - a range;
26 - a scale;
27 - an alarm level.
28
29 \image html sysinfo.png
30
31 The fill colors might be calculated from an optional color map
[9383]32 If no color map has been assigned QwtThermo uses the
[8127]33 following colors/brushes from the widget palette:
34
35 - QPalette::Base
36 Background of the pipe
37 - QPalette::ButtonText
38 Fill brush below the alarm level
39 - QPalette::Highlight
40 Fill brush for the values above the alarm level
41 - QPalette::WindowText
42 For the axis of the scale
43 - QPalette::Text
44 For the labels of the scale
45*/
46class QWT_EXPORT QwtThermo: public QwtAbstractScale
47{
48 Q_OBJECT
49
50 Q_ENUMS( ScalePosition )
51 Q_ENUMS( OriginMode )
52
53 Q_PROPERTY( Qt::Orientation orientation
54 READ orientation WRITE setOrientation )
[9383]55 Q_PROPERTY( ScalePosition scalePosition
[8127]56 READ scalePosition WRITE setScalePosition )
57 Q_PROPERTY( OriginMode originMode READ originMode WRITE setOriginMode )
58
59 Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled )
60 Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel )
61 Q_PROPERTY( double origin READ origin WRITE setOrigin )
62 Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
63 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
64 Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth )
65 Q_PROPERTY( double value READ value WRITE setValue )
66
67public:
68
69 /*!
70 Position of the scale
71 \sa setScalePosition(), setOrientation()
72 */
73 enum ScalePosition
74 {
75 //! The slider has no scale
76 NoScale,
77
78 //! The scale is right of a vertical or below of a horizontal slider
79 LeadingScale,
80
81 //! The scale is left of a vertical or above of a horizontal slider
82 TrailingScale
83 };
84
85 /*!
86 Origin mode. This property specifies where the beginning of the liquid
87 is placed.
88
89 \sa setOriginMode(), setOrigin()
90 */
91 enum OriginMode
92 {
93 //! The origin is the minimum of the scale
94 OriginMinimum,
95
96 //! The origin is the maximum of the scale
97 OriginMaximum,
98
99 //! The origin is specified using the origin() property
100 OriginCustom
101 };
102
103 explicit QwtThermo( QWidget *parent = NULL );
104 virtual ~QwtThermo();
105
106 void setOrientation( Qt::Orientation );
107 Qt::Orientation orientation() const;
108
109 void setScalePosition( ScalePosition );
110 ScalePosition scalePosition() const;
111
112 void setSpacing( int );
113 int spacing() const;
114
[9383]115 void setBorderWidth( int );
[8127]116 int borderWidth() const;
117
118 void setOriginMode( OriginMode );
119 OriginMode originMode() const;
120
121 void setOrigin( double );
122 double origin() const;
123
[9383]124 void setFillBrush( const QBrush & );
[8127]125 QBrush fillBrush() const;
126
[9383]127 void setAlarmBrush( const QBrush & );
[8127]128 QBrush alarmBrush() const;
129
[9383]130 void setAlarmLevel( double );
[8127]131 double alarmLevel() const;
132
[9383]133 void setAlarmEnabled( bool );
[8127]134 bool alarmEnabled() const;
135
136 void setColorMap( QwtColorMap * );
137 QwtColorMap *colorMap();
138 const QwtColorMap *colorMap() const;
139
[9383]140 void setPipeWidth( int );
[8127]141 int pipeWidth() const;
142
143 void setRangeFlags( QwtInterval::BorderFlags );
144 QwtInterval::BorderFlags rangeFlags() const;
145
146 double value() const;
147
148 virtual QSize sizeHint() const;
149 virtual QSize minimumSizeHint() const;
150
151 void setScaleDraw( QwtScaleDraw * );
152 const QwtScaleDraw *scaleDraw() const;
153
154public Q_SLOTS:
[9383]155 virtual void setValue( double );
[8127]156
157protected:
158 virtual void drawLiquid( QPainter *, const QRect & ) const;
159 virtual void scaleChange();
160
161 virtual void paintEvent( QPaintEvent * );
162 virtual void resizeEvent( QResizeEvent * );
163 virtual void changeEvent( QEvent * );
164
165 QwtScaleDraw *scaleDraw();
166
167 QRect pipeRect() const;
168 QRect fillRect( const QRect & ) const;
169 QRect alarmRect( const QRect & ) const;
170
171private:
172 void layoutThermo( bool );
173
174 class PrivateData;
175 PrivateData *d_data;
176};
177
178#endif
Note: See TracBrowser for help on using the repository browser.