Qwt User's Guide 5.2.3

- 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 // vim: expandtab
11
12 #ifndef QWT_COUNTER_H
13 #define QWT_COUNTER_H
14
15 #include <qwidget.h>
16 #include "qwt_global.h"
17 #include "qwt_double_range.h"
18
60 class QWT_EXPORT QwtCounter : public QWidget, public QwtDoubleRange
61 {
62 Q_OBJECT
63
64 Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons )
65 Q_PROPERTY( double basicstep READ step WRITE setStep )
66 Q_PROPERTY( double minValue READ minVal WRITE setMinValue )
67 Q_PROPERTY( double maxValue READ maxVal WRITE setMaxValue )
68 Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 )
69 Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 )
70 Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 )
71 Q_PROPERTY( double value READ value WRITE setValue )
72 Q_PROPERTY( bool editable READ editable WRITE setEditable )
73
74 public:
79 enum Button
80 {
81 Button1,
82 Button2,
83 Button3,
84 ButtonCnt
85 };
86
87 explicit QwtCounter(QWidget *parent = NULL);
88 #if QT_VERSION < 0x040000
89 explicit QwtCounter(QWidget *parent, const char *name);
90 #endif
91 virtual ~QwtCounter();
92
93 bool editable() const;
94 void setEditable(bool);
95
96 void setNumButtons(int n);
97 int numButtons() const;
98
99 void setIncSteps(QwtCounter::Button btn, int nSteps);
100 int incSteps(QwtCounter::Button btn) const;
101
102 virtual void setValue(double);
103 virtual QSize sizeHint() const;
104
105 virtual void polish();
106
107 // a set of dummies to help the designer
108
109 double step() const;
110 void setStep(double s);
111 double minVal() const;
112 void setMinValue(double m);
113 double maxVal() const;
114 void setMaxValue(double m);
115 void setStepButton1(int nSteps);
116 int stepButton1() const;
117 void setStepButton2(int nSteps);
118 int stepButton2() const;
119 void setStepButton3(int nSteps);
120 int stepButton3() const;
121 virtual double value() const;
122
123 signals:
128 void buttonReleased (double value);
129
134 void valueChanged (double value);
135
136 protected:
137 virtual bool event(QEvent *);
138 virtual void wheelEvent(QWheelEvent *);
139 virtual void keyPressEvent(QKeyEvent *);
140 virtual void rangeChange();
141
142 private slots:
143 void btnReleased();
144 void btnClicked();
145 void textChanged();
146
147 private:
148 void initCounter();
149 void updateButtons();
150 void showNum(double);
151 virtual void valueChange();
152
153 class PrivateData;
154 PrivateData *d_data;
155 };
156
157 #endif