The Counter Widget.
More...
#include <qwt_counter.h>
|
| void | setValue (double) |
| | Set a new value without adjusting to the step raster.
|
| |
|
| void | buttonReleased (double value) |
| | This signal is emitted when a button has been released.
|
| |
| void | valueChanged (double value) |
| | This signal is emitted when the counter's value has changed.
|
| |
|
| | QwtCounter (QWidget *parent=NULL) |
| | The counter is initialized with a range is set to [0.0, 1.0] with 0.01 as single step size.
|
| |
|
virtual | ~QwtCounter () |
| | Destructor.
|
| |
| void | setValid (bool) |
| | Set the counter to be in valid/invalid state.
|
| |
| bool | isValid () const |
| |
| void | setWrapping (bool) |
| | En/Disable wrapping.
|
| |
| bool | wrapping () const |
| |
| bool | isReadOnly () const |
| |
| void | setReadOnly (bool) |
| | Allow/disallow the user to manually edit the value.
|
| |
| void | setNumButtons (int) |
| | Specify the number of buttons on each side of the label.
|
| |
| int | numButtons () const |
| |
| void | setIncSteps (QwtCounter::Button, int numSteps) |
| | Specify the number of steps by which the value is incremented or decremented when a specified button is pushed.
|
| |
| int | incSteps (QwtCounter::Button) const |
| |
|
virtual QSize | sizeHint () const QWT_OVERRIDE |
| | A size hint.
|
| |
| double | singleStep () const |
| |
| void | setSingleStep (double stepSize) |
| | Set the step size of the counter.
|
| |
| void | setRange (double min, double max) |
| | Set the minimum and maximum values.
|
| |
| double | minimum () const |
| |
| void | setMinimum (double) |
| | Set the minimum value of the range.
|
| |
| double | maximum () const |
| |
| void | setMaximum (double) |
| | Set the maximum value of the range.
|
| |
| void | setStepButton1 (int nSteps) |
| | Set the number of increment steps for button 1.
|
| |
|
int | stepButton1 () const |
| | returns the number of increment steps for button 1
|
| |
| void | setStepButton2 (int nSteps) |
| | Set the number of increment steps for button 2.
|
| |
|
int | stepButton2 () const |
| | returns the number of increment steps for button 2
|
| |
| void | setStepButton3 (int nSteps) |
| | Set the number of increment steps for button 3.
|
| |
|
int | stepButton3 () const |
| | returns the number of increment steps for button 3
|
| |
| double | value () const |
| |
|
| virtual bool | event (QEvent *) QWT_OVERRIDE |
| | Handle QEvent::PolishRequest events.
|
| |
| virtual void | wheelEvent (QWheelEvent *) QWT_OVERRIDE |
| | Handle wheel events.
|
| |
| virtual void | keyPressEvent (QKeyEvent *) QWT_OVERRIDE |
| | Handle key events.
|
| |
|
|
double | value |
| |
|
double | minimum |
| |
|
double | maximum |
| |
|
double | singleStep |
| |
|
int | numButtons |
| |
|
int | stepButton1 |
| |
|
int | stepButton2 |
| |
|
int | stepButton3 |
| |
|
bool | readOnly |
| |
|
bool | wrapping |
| |
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:
#include <qwt_counter.h>
connect(counter, SIGNAL(
valueChanged(
double)), myClass, SLOT(newValue(
double)));
The Counter Widget.
Definition qwt_counter.h:66
@ Button1
Button intended for minor steps.
Definition qwt_counter.h:87
@ Button2
Button intended for medium steps.
Definition qwt_counter.h:90
void setNumButtons(int)
Specify the number of buttons on each side of the label.
Definition qwt_counter.cpp:360
void setIncSteps(QwtCounter::Button, int numSteps)
Specify the number of steps by which the value is incremented or decremented when a specified button ...
Definition qwt_counter.cpp:397
void setRange(double min, double max)
Set the minimum and maximum values.
Definition qwt_counter.cpp:241
void valueChanged(double value)
This signal is emitted when the counter's value has changed.
void setSingleStep(double stepSize)
Set the step size of the counter.
Definition qwt_counter.cpp:317
◆ Button
Button index.
| Enumerator |
|---|
| Button1 | Button intended for minor steps.
|
| Button2 | Button intended for medium steps.
|
| Button3 | Button intended for large steps.
|
| ButtonCnt | Number of buttons.
|
◆ QwtCounter()
| QwtCounter::QwtCounter |
( |
QWidget * |
parent = NULL | ) |
|
|
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:
- Button 1: 1 step
- Button 2: 10 steps
- Button 3: 100 steps
- Parameters
-
◆ buttonReleased
| void QwtCounter::buttonReleased |
( |
double |
value | ) |
|
|
signal |
This signal is emitted when a button has been released.
- Parameters
-
◆ event()
| bool QwtCounter::event |
( |
QEvent * |
event | ) |
|
|
protectedvirtual |
Handle QEvent::PolishRequest events.
- Parameters
-
- Returns
- see QWidget::event()
◆ incSteps()
- Returns
- The number of steps by which a specified button increments the value or 0 if the button is invalid.
- Parameters
-
- See also
- setIncSteps()
◆ isReadOnly()
| bool QwtCounter::isReadOnly |
( |
| ) |
const |
- Returns
- True, when the line line edit is read only. (default is no)
- See also
- setReadOnly()
◆ isValid()
| bool QwtCounter::isValid |
( |
| ) |
const |
◆ keyPressEvent()
| void QwtCounter::keyPressEvent |
( |
QKeyEvent * |
event | ) |
|
|
protectedvirtual |
Handle key events.
- Ctrl + Qt::Key_Home
Step to minimum()
- Ctrl + Qt::Key_End
Step to maximum()
- Qt::Key_Up
Increment by incSteps(QwtCounter::Button1)
- Qt::Key_Down
Decrement by incSteps(QwtCounter::Button1)
- Qt::Key_PageUp
Increment by incSteps(QwtCounter::Button2)
- Qt::Key_PageDown
Decrement by incSteps(QwtCounter::Button2)
- Shift + Qt::Key_PageUp
Increment by incSteps(QwtCounter::Button3)
- Shift + Qt::Key_PageDown
Decrement by incSteps(QwtCounter::Button3)
- Parameters
-
◆ maximum()
| double QwtCounter::maximum |
( |
| ) |
const |
◆ minimum()
| double QwtCounter::minimum |
( |
| ) |
const |
◆ numButtons()
| int QwtCounter::numButtons |
( |
| ) |
const |
- Returns
- The number of buttons on each side of the widget.
- See also
- setNumButtons()
◆ setIncSteps()
Specify the number of steps by which the value is incremented or decremented when a specified button is pushed.
- Parameters
-
| button | Button index |
| numSteps | Number of steps |
- See also
- incSteps()
◆ setMaximum()
| void QwtCounter::setMaximum |
( |
double |
value | ) |
|
◆ setMinimum()
| void QwtCounter::setMinimum |
( |
double |
value | ) |
|
Set the minimum value of the range.
- Parameters
-
- See also
- setRange(), setMaximum(), minimum()
- Note
- The maximum is adjusted if necessary to ensure that the range remains valid.
◆ setNumButtons()
| void QwtCounter::setNumButtons |
( |
int |
numButtons | ) |
|
Specify the number of buttons on each side of the label.
- Parameters
-
| numButtons | Number of buttons |
- See also
- numButtons()
◆ setRange()
| void QwtCounter::setRange |
( |
double |
min, |
|
|
double |
max |
|
) |
| |
Set the minimum and maximum values.
The maximum is adjusted if necessary to ensure that the range remains valid. The value might be modified to be inside of the range.
- Parameters
-
| min | Minimum value |
| max | Maximum value |
- See also
- minimum(), maximum()
◆ setReadOnly()
| void QwtCounter::setReadOnly |
( |
bool |
on | ) |
|
Allow/disallow the user to manually edit the value.
- Parameters
-
- See also
- isReadOnly()
◆ setSingleStep()
| void QwtCounter::setSingleStep |
( |
double |
stepSize | ) |
|
Set the step size of the counter.
A value <= 0.0 disables stepping
- Parameters
-
- See also
- singleStep()
◆ setStepButton1()
| void QwtCounter::setStepButton1 |
( |
int |
nSteps | ) |
|
Set the number of increment steps for button 1.
- Parameters
-
◆ setStepButton2()
| void QwtCounter::setStepButton2 |
( |
int |
nSteps | ) |
|
Set the number of increment steps for button 2.
- Parameters
-
◆ setStepButton3()
| void QwtCounter::setStepButton3 |
( |
int |
nSteps | ) |
|
Set the number of increment steps for button 3.
- Parameters
-
◆ setValid()
| 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.
- Parameters
-
| on | If true the counter will be set as valid |
- See also
- setValue(), isValid()
◆ setValue
| void QwtCounter::setValue |
( |
double |
value | ) |
|
|
slot |
Set a new value without adjusting to the step raster.
The state of the counter is set to be valid.
- Parameters
-
- See also
- isValid(), value(), valueChanged()
- Warning
- The value is clipped when it lies outside the range.
◆ setWrapping()
| 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.
- Parameters
-
- See also
- wrapping()
◆ singleStep()
| double QwtCounter::singleStep |
( |
| ) |
const |
◆ value()
| double QwtCounter::value |
( |
| ) |
const |
◆ valueChanged
| void QwtCounter::valueChanged |
( |
double |
value | ) |
|
|
signal |
This signal is emitted when the counter's value has changed.
- Parameters
-
◆ wheelEvent()
| void QwtCounter::wheelEvent |
( |
QWheelEvent * |
event | ) |
|
|
protectedvirtual |
Handle wheel events.
- Parameters
-
◆ wrapping()
| bool QwtCounter::wrapping |
( |
| ) |
const |
The documentation for this class was generated from the following files:
- /home/runner/work/QWT/QWT/src/qwt_counter.h
- /home/runner/work/QWT/QWT/src/qwt_counter.cpp