Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

qwt_counter.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_COUNTER_H
11 #define QWT_COUNTER_H
12
13 #include "qwt_global.h"
14 #include "qwt_double_range.h"
15 #include <qwidget.h>
16
46 class QWT_EXPORT QwtCounter : public QWidget, public QwtDoubleRange
47 {
48 Q_OBJECT
49
50 Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons )
51 Q_PROPERTY( double basicstep READ step WRITE setStep )
52 Q_PROPERTY( double minValue READ minValue WRITE setMinValue )
53 Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue )
54 Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 )
55 Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 )
56 Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 )
57 Q_PROPERTY( double value READ value WRITE setValue )
58 Q_PROPERTY( bool editable READ editable WRITE setEditable )
59
60 public:
62 enum Button
63 {
65 Button1,
66
68 Button2,
69
71 Button3,
72
74 ButtonCnt
75 };
76
77 explicit QwtCounter( QWidget *parent = NULL );
78 virtual ~QwtCounter();
79
80 bool editable() const;
81 void setEditable( bool );
82
83 void setNumButtons( int n );
84 int numButtons() const;
85
86 void setIncSteps( QwtCounter::Button btn, int nSteps );
87 int incSteps( QwtCounter::Button btn ) const;
88
89 virtual void setValue( double );
90 virtual QSize sizeHint() const;
91
92 // a set of dummies to help the designer
93
94 double step() const;
95 void setStep( double s );
96
97 double minValue() const;
98 void setMinValue( double m );
99
100 double maxValue() const;
101 void setMaxValue( double m );
102
103 void setStepButton1( int nSteps );
104 int stepButton1() const;
105
106 void setStepButton2( int nSteps );
107 int stepButton2() const;
108
109 void setStepButton3( int nSteps );
110 int stepButton3() const;
111
112 virtual double value() const;
113
114 Q_SIGNALS:
119 void buttonReleased ( double value );
120
125 void valueChanged ( double value );
126
127 protected:
128 virtual bool event( QEvent * );
129 virtual void wheelEvent( QWheelEvent * );
130 virtual void keyPressEvent( QKeyEvent * );
131 virtual void rangeChange();
132
133 private Q_SLOTS:
134 void btnReleased();
135 void btnClicked();
136 void textChanged();
137
138 private:
139 void initCounter();
140 void updateButtons();
141 void showNum( double );
142 virtual void valueChange();
143
144 class PrivateData;
145 PrivateData *d_data;
146 };
147
148 #endif