Qwt User's Guide
6.1.6
|
The Counter Widget. More...
#include <qwt_counter.h>
Public Types | |
enum | Button { Button1, Button2, Button3, ButtonCnt } |
Button index. More... | |
Public Slots | |
void | setValue (double) |
Set a new value without adjusting to the step raster. More... | |
Signals | |
void | buttonReleased (double value) |
void | valueChanged (double value) |
Public Member Functions | |
QwtCounter (QWidget *parent=NULL) | |
virtual | ~QwtCounter () |
Destructor. | |
void | setValid (bool) |
bool | isValid () const |
void | setWrapping (bool) |
En/Disable wrapping. More... | |
bool | wrapping () const |
bool | isReadOnly () const |
void | setReadOnly (bool) |
Allow/disallow the user to manually edit the value. More... | |
void | setNumButtons (int) |
int | numButtons () const |
void | setIncSteps (QwtCounter::Button, int numSteps) |
int | incSteps (QwtCounter::Button) const |
virtual QSize | sizeHint () const |
A size hint. | |
double | singleStep () const |
void | setSingleStep (double stepSize) |
Set the step size of the counter. More... | |
void | setRange (double min, double max) |
Set the minimum and maximum values. More... | |
double | minimum () const |
void | setMinimum (double) |
double | maximum () const |
void | setMaximum (double) |
void | setStepButton1 (int nSteps) |
int | stepButton1 () const |
returns the number of increment steps for button 1 | |
void | setStepButton2 (int nSteps) |
int | stepButton2 () const |
returns the number of increment steps for button 2 | |
void | setStepButton3 (int nSteps) |
int | stepButton3 () const |
returns the number of increment steps for button 3 | |
double | value () const |
Protected Member Functions | |
virtual bool | event (QEvent *) |
virtual void | wheelEvent (QWheelEvent *) |
virtual void | keyPressEvent (QKeyEvent *) |
The Counter Widget.
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. When the wrapping property is set the counter is circular.
The number of steps by which a button increments or decrements the value can be specified using setIncSteps(). The number of buttons can be changed with setNumButtons().
Example:
enum QwtCounter::Button |
|
explicit |
The counter is initialized with a range is set to [0.0, 1.0] with 0.01 as single step size. The value is invalid.
The default number of buttons is set to 2. The default increments are:
parent |
|
signal |
This signal is emitted when a button has been released
value | The new value |
|
protectedvirtual |
Handle QEvent::PolishRequest events
event | Event |
int QwtCounter::incSteps | ( | QwtCounter::Button | button | ) | const |
button | Button index |
bool QwtCounter::isReadOnly | ( | ) | const |
bool QwtCounter::isValid | ( | ) | const |
|
protectedvirtual |
Handle key events
event | Key event |
double QwtCounter::maximum | ( | ) | const |
double QwtCounter::minimum | ( | ) | const |
int QwtCounter::numButtons | ( | ) | const |
void QwtCounter::setIncSteps | ( | QwtCounter::Button | button, |
int | numSteps | ||
) |
Specify the number of steps by which the value is incremented or decremented when a specified button is pushed.
button | Button index |
numSteps | Number of steps |
void QwtCounter::setMaximum | ( | double | value | ) |
Set the maximum value of the range
value | Maximum value |
void QwtCounter::setMinimum | ( | double | value | ) |
Set the minimum value of the range
value | Minimum value |
void QwtCounter::setNumButtons | ( | int | numButtons | ) |
Specify the number of buttons on each side of the label
numButtons | Number of buttons |
void QwtCounter::setRange | ( | double | min, |
double | max | ||
) |
void QwtCounter::setReadOnly | ( | bool | on | ) |
Allow/disallow the user to manually edit the value.
on | True disable editing |
void QwtCounter::setSingleStep | ( | double | stepSize | ) |
Set the step size of the counter.
A value <= 0.0 disables stepping
stepSize | Single step size |
void QwtCounter::setStepButton1 | ( | int | nSteps | ) |
Set the number of increment steps for button 1
nSteps | Number of steps |
void QwtCounter::setStepButton2 | ( | int | nSteps | ) |
Set the number of increment steps for button 2
nSteps | Number of steps |
void QwtCounter::setStepButton3 | ( | int | nSteps | ) |
Set the number of increment steps for button 3
nSteps | Number of steps |
void QwtCounter::setValid | ( | bool | on | ) |
Set the counter to be in valid/invalid state
When the counter is set to invalid, no numbers are displayed and the buttons are disabled.
on | If true the counter will be set as valid |
|
slot |
Set a new value without adjusting to the step raster.
The state of the counter is set to be valid.
value | New value |
void QwtCounter::setWrapping | ( | bool | on | ) |
En/Disable wrapping.
If wrapping is true stepping up from maximum() value will take you to the minimum() value and vice versa.
on | En/Disable wrapping |
double QwtCounter::singleStep | ( | ) | const |
double QwtCounter::value | ( | ) | const |
|
signal |
This signal is emitted when the counter's value has changed
value | The new value |
|
protectedvirtual |
Handle wheel events
event | Wheel event |
bool QwtCounter::wrapping | ( | ) | const |