

A Counter consists of a label displaying a number and one ore more (up to three) push buttons on each side of the label which can be used to increment or decrement the counter's value.
A Counter has a range from a minimum value to a maximum value and a step size. The range can be specified using QwtDblRange::setRange(). The counter's value is an integer multiple of the step size. The number of steps by which a button increments or decrements the value can be specified using QwtCounter::setIncSteps(). The number of buttons can be changed with QwtCounter::setNumButtons().
Holding the space bar down with focus on a button is the fastest method to step through the counter values. When the counter underflows/overflows, the focus is set to the smallest up/down button and counting is disabled. Counting is re-enabled on a button release event (mouse or space bar).
Example:
#include "../include/qwt_counter.h> QwtCounter *cnt; cnt = new QwtCounter(parent, name); cnt->setRange(0.0, 100.0, 1.0); // From 0.0 to 100, step 1.0 cnt->setNumButtons(2); // Two buttons each side cnt->setIncSteps(QwtCounter::Button1, 1); // Button 1 increments 1 step cnt->setIncSteps(QwtCounter::Button2, 20); // Button 2 increments 20 steps connect(cnt, SIGNAL(valueChanged(double)), my_class, SLOT(newValue(double)));
Definition at line 60 of file qwt_counter.h.
| Public Types | |
| enum | Button { Button1, Button2, Button3, ButtonCnt } | 
| Signals | |
| void | buttonReleased (double value) | 
| void | valueChanged (double value) | 
| Public Member Functions | |
| QwtCounter (QWidget *parent=NULL) | |
| virtual | ~QwtCounter () | 
| bool | editable () const | 
| void | setEditable (bool) | 
| void | setNumButtons (int n) | 
| int | numButtons () const | 
| void | setIncSteps (QwtCounter::Button btn, int nSteps) | 
| int | incSteps (QwtCounter::Button btn) const | 
| virtual void | setValue (double) | 
| virtual QSize | sizeHint () const | 
| virtual void | polish () | 
| double | step () const | 
| void | setStep (double s) | 
| double | minVal () const | 
| void | setMinValue (double m) | 
| double | maxVal () const | 
| void | setMaxValue (double m) | 
| void | setStepButton1 (int nSteps) | 
| int | stepButton1 () const | 
| void | setStepButton2 (int nSteps) | 
| int | stepButton2 () const | 
| void | setStepButton3 (int nSteps) | 
| int | stepButton3 () const | 
| virtual double | value () const | 
| Protected Member Functions | |
| virtual bool | event (QEvent *) | 
| virtual void | wheelEvent (QWheelEvent *) | 
| virtual void | keyPressEvent (QKeyEvent *) | 
| virtual void | rangeChange () | 
| 
 | 
| Button index Definition at line 79 of file qwt_counter.h. | 
| 
 | 
| The default number of buttons is set to 2. The default increments are: 
 
 Definition at line 50 of file qwt_counter.cpp. | 
| 
 | 
| Destructor. 
 Definition at line 143 of file qwt_counter.cpp. | 
| 
 | 
| This signal is emitted when a button has been released 
 | 
| 
 | 
| returns whether the line edit is edatble. (default is yes) 
 Definition at line 198 of file qwt_counter.cpp. | 
| 
 | 
| Handle PolishRequest events Definition at line 206 of file qwt_counter.cpp. References polish(). | 
| 
 | 
| 
 
 
 Definition at line 367 of file qwt_counter.cpp. Referenced by stepButton1(), stepButton2(), and stepButton3(). | 
| 
 | 
| Handles key events 
 
 Definition at line 236 of file qwt_counter.cpp. References QwtDoubleRange::incValue(), QwtDoubleRange::maxValue(), QwtDoubleRange::minValue(), and setValue(). | 
| 
 | 
| returns the maximum value of the range 
 Definition at line 574 of file qwt_counter.cpp. References QwtDoubleRange::maxValue(). | 
| 
 | 
| returns the minimum value of the range 
 Definition at line 562 of file qwt_counter.cpp. References QwtDoubleRange::minValue(). | 
| 
 | 
| 
 
 Definition at line 466 of file qwt_counter.cpp. | 
| 
 | 
| Sets the minimum width for the buttons Definition at line 151 of file qwt_counter.cpp. Referenced by event(). | 
| 
 | 
| Notify change of range. This function updates the enabled property of all buttons contained in QwtCounter. Reimplemented from QwtDoubleRange. Definition at line 507 of file qwt_counter.cpp. | 
| 
 | 
| Allow/disallow the user to manually edit the value. 
 
 
 Definition at line 185 of file qwt_counter.cpp. | 
| 
 | ||||||||||||
| Specify the number of steps by which the value is incremented or decremented when a specified button is pushed. 
 
 Definition at line 355 of file qwt_counter.cpp. Referenced by setStepButton1(), setStepButton2(), and setStepButton3(). | 
| 
 | 
| sets the maximum value of the range 
 Definition at line 580 of file qwt_counter.cpp. References QwtDoubleRange::minValue(), QwtDoubleRange::setRange(), and step(). | 
| 
 | 
| sets the minimum value of the range 
 Definition at line 568 of file qwt_counter.cpp. References QwtDoubleRange::maxValue(), QwtDoubleRange::setRange(), and step(). | 
| 
 | 
| Specify the number of buttons on each side of the label. 
 
 Definition at line 441 of file qwt_counter.cpp. | 
| 
 | 
| sets the step size 
 Reimplemented from QwtDoubleRange. Definition at line 556 of file qwt_counter.cpp. References QwtDoubleRange::setStep(). | 
| 
 | 
| set the number of increment steps for button 1 
 Definition at line 586 of file qwt_counter.cpp. References setIncSteps(). | 
| 
 | 
| set the number of increment steps for button 2 
 Definition at line 598 of file qwt_counter.cpp. References setIncSteps(). | 
| 
 | 
| set the number of increment steps for button 3 
 Definition at line 610 of file qwt_counter.cpp. References setIncSteps(). | 
| 
 | 
| Set a new value. 
 
 
 Reimplemented from QwtDoubleRange. Definition at line 382 of file qwt_counter.cpp. References QwtDoubleRange::setValue(), and value(). Referenced by keyPressEvent(). | 
| 
 | 
| A size hint. 
 Definition at line 513 of file qwt_counter.cpp. References QwtDoubleRange::maxValue(), QwtDoubleRange::minValue(), and step(). | 
| 
 | 
| returns the step size 
 Reimplemented from QwtDoubleRange. Definition at line 550 of file qwt_counter.cpp. References QwtDoubleRange::step(). Referenced by setMaxValue(), setMinValue(), and sizeHint(). | 
| 
 | 
| returns the number of increment steps for button 1 
 Definition at line 592 of file qwt_counter.cpp. References incSteps(). | 
| 
 | 
| returns the number of increment steps for button 2 
 Definition at line 604 of file qwt_counter.cpp. References incSteps(). | 
| 
 | 
| returns the number of increment steps for button 3 
 Definition at line 616 of file qwt_counter.cpp. References incSteps(). | 
| 
 | 
| Returns the current value. 
 Reimplemented from QwtDoubleRange. Definition at line 621 of file qwt_counter.cpp. References QwtDoubleRange::value(). Referenced by setValue(). | 
| 
 | 
| This signal is emitted when the counter's value has changed 
 | 
 1.4.6
 1.4.6