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) |
| | Signal emitted when a button has been released.
|
| |
| void | valueChanged (double value) |
| | Signal emitted when the counter's value has changed.
|
| |
|
| | QwtCounter (QWidget *parent=nullptr) |
| | Constructor.
|
| |
|
| ~QwtCounter () override |
| | Destructor.
|
| |
| void | setValid (bool) |
| | Set the counter to be in valid/invalid state.
|
| |
| bool | isValid () const |
| | Return true if the value is valid.
|
| |
| void | setWrapping (bool) |
| | Enable or disable wrapping.
|
| |
| bool | wrapping () const |
| | Return true if wrapping is enabled.
|
| |
| bool | isReadOnly () const |
| | Return true if the counter is read only.
|
| |
| void | setReadOnly (bool) |
| | Set the counter to read only mode.
|
| |
| void | setNumButtons (int) |
| | Set the number of buttons on each side.
|
| |
| int | numButtons () const |
| | Return the number of buttons.
|
| |
| void | setIncSteps (QwtCounter::Button, int numSteps) |
| | Set the number of increment steps for a button.
|
| |
| int | incSteps (QwtCounter::Button) const |
| | Return the number of increment steps for a button.
|
| |
|
virtual QSize | sizeHint () const override |
| | Return a size hint.
|
| |
| double | singleStep () const |
| | Return the single step size.
|
| |
| void | setSingleStep (double stepSize) |
| | Set the single step size.
|
| |
| void | setRange (double min, double max) |
| | Set the range of the counter.
|
| |
| double | minimum () const |
| | Return the minimum value.
|
| |
| void | setMinimum (double) |
| | Set the minimum value.
|
| |
| double | maximum () const |
| | Return the maximum value.
|
| |
| void | setMaximum (double) |
| | Set the maximum value.
|
| |
| void | setStepButton1 (int nSteps) |
| | Set the number of increment steps for button 1.
|
| |
| int | stepButton1 () const |
| | Return the number of increment steps for button 1.
|
| |
| void | setStepButton2 (int nSteps) |
| | Set the number of increment steps for button 2.
|
| |
| int | stepButton2 () const |
| | Return the number of increment steps for button 2.
|
| |
| void | setStepButton3 (int nSteps) |
| | Set the number of increment steps for button 3.
|
| |
| int | stepButton3 () const |
| | Return the number of increment steps for button 3.
|
| |
| double | value () const |
| | Return the current value.
|
| |
|
| virtual bool | event (QEvent *) override |
| | Handle QEvent::PolishRequest events.
|
| |
| virtual void | wheelEvent (QWheelEvent *) override |
| | Handle wheel events.
|
| |
| virtual void | keyPressEvent (QKeyEvent *) 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 or 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:59
@ Button1
Button intended for minor steps.
Definition qwt_counter.h:82
@ Button2
Button intended for medium steps.
Definition qwt_counter.h:85
void setNumButtons(int)
Set the number of buttons on each side.
Definition qwt_counter.cpp:358
void setIncSteps(QwtCounter::Button, int numSteps)
Set the number of increment steps for a button.
Definition qwt_counter.cpp:393
void setRange(double min, double max)
Set the range of the counter.
Definition qwt_counter.cpp:240
void valueChanged(double value)
Signal emitted when the counter's value has changed.
void setSingleStep(double stepSize)
Set the single step size.
Definition qwt_counter.cpp:314
◆ 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 = nullptr | ) |
|
|
explicit |
Constructor.
The counter is initialized with a range 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 |
Signal emitted when a button has been released.
- Parameters
-
◆ event()
| bool QwtCounter::event |
( |
QEvent * |
event | ) |
|
|
overrideprotectedvirtual |
Handle QEvent::PolishRequest events.
- Parameters
-
- Returns
- see QWidget::event()
◆ incSteps()
Return the number of increment steps for a button.
Return the number of steps by which a specified button increments the value, or 0 if the button is invalid.
- Parameters
-
- Returns
- Number of increment steps
- See also
- setIncSteps()
◆ isReadOnly()
| bool QwtCounter::isReadOnly |
( |
| ) |
const |
Return true if the counter is read only.
Return true when the line edit is read only.
- See also
- setReadOnly()
◆ isValid()
| bool QwtCounter::isValid |
( |
| ) |
const |
◆ keyPressEvent()
| void QwtCounter::keyPressEvent |
( |
QKeyEvent * |
event | ) |
|
|
overrideprotectedvirtual |
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 |
Return the number of buttons.
Return the number of buttons on each side of the widget.
- See also
- setNumButtons()
◆ setIncSteps()
Set the number of increment steps for a button.
Specify the number of steps by which the value is incremented or decremented when a specified button is pushed.
- Parameters
-
| [in] | button | Button index |
| [in] | numSteps | Number of steps |
- See also
- incSteps()
◆ setMaximum()
| void QwtCounter::setMaximum |
( |
double |
value | ) |
|
Set the maximum value.
Set the maximum value of the range.
- Parameters
-
- See also
- setRange(), setMinimum(), maximum()
◆ setMinimum()
| void QwtCounter::setMinimum |
( |
double |
value | ) |
|
Set the minimum 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 | ) |
|
Set the number of buttons on each side.
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 range of the counter.
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
-
| [in] | min | Minimum value |
| [in] | max | Maximum value |
- See also
- minimum(), maximum()
◆ setReadOnly()
| void QwtCounter::setReadOnly |
( |
bool |
on | ) |
|
Set the counter to read only mode.
Allow/disallow the user to manually edit the value.
- Parameters
-
- See also
- isReadOnly()
◆ setSingleStep()
| void QwtCounter::setSingleStep |
( |
double |
stepSize | ) |
|
Set the single step size.
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
-
- See also
- stepButton1()
◆ setStepButton2()
| void QwtCounter::setStepButton2 |
( |
int |
nSteps | ) |
|
Set the number of increment steps for button 2.
- Parameters
-
- See also
- stepButton2()
◆ setStepButton3()
| void QwtCounter::setStepButton3 |
( |
int |
nSteps | ) |
|
Set the number of increment steps for button 3.
- Parameters
-
- See also
- stepButton3()
◆ 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 | ) |
|
Enable or disable wrapping.
Enable/disable wrapping.
If wrapping is true stepping up from maximum() value will take you to the minimum() value and vice versa.
- Parameters
-
| on | Enable/disable wrapping |
- See also
- wrapping()
◆ singleStep()
| double QwtCounter::singleStep |
( |
| ) |
const |
Return the single step size.
Return single step size.
- See also
- setSingleStep()
◆ stepButton1()
| int QwtCounter::stepButton1 |
( |
| ) |
const |
◆ stepButton2()
| int QwtCounter::stepButton2 |
( |
| ) |
const |
◆ stepButton3()
| int QwtCounter::stepButton3 |
( |
| ) |
const |
◆ value()
| double QwtCounter::value |
( |
| ) |
const |
◆ valueChanged
| void QwtCounter::valueChanged |
( |
double |
value | ) |
|
|
signal |
Signal emitted when the counter's value has changed.
- Parameters
-
◆ wheelEvent()
| void QwtCounter::wheelEvent |
( |
QWheelEvent * |
event | ) |
|
|
overrideprotectedvirtual |
Handle wheel events.
- Parameters
-
◆ wrapping()
| bool QwtCounter::wrapping |
( |
| ) |
const |
Return true if wrapping is enabled.
Return true when wrapping is set.
- See also
- setWrapping()
The documentation for this class was generated from the following files:
- /home/runner/work/QWT/QWT/src/plot/qwt_counter.h
- /home/runner/work/QWT/QWT/src/plot/qwt_counter.cpp