The Counter Widget
更多...
#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
| 枚举值 |
|---|
| 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
- 参数
-
◆ buttonReleased
| void QwtCounter::buttonReleased |
( |
double |
value | ) |
|
|
signal |
Signal emitted when a button has been released
- 参数
-
◆ event()
| bool QwtCounter::event |
( |
QEvent * |
event | ) |
|
|
overrideprotectedvirtual |
Handle QEvent::PolishRequest events
- 参数
-
- 返回
- 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
- 参数
-
- 返回
- Number of increment steps
- 参见
- setIncSteps()
◆ isReadOnly()
| bool QwtCounter::isReadOnly |
( |
| ) |
const |
Return true if the counter is read only
Return true when the line edit is read only
- 参见
- 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)
- 参数
-
◆ 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
- 参见
- 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
- 参数
-
| [in] | button | Button index |
| [in] | numSteps | Number of steps |
- 参见
- incSteps()
◆ setMaximum()
| void QwtCounter::setMaximum |
( |
double |
value | ) |
|
◆ setMinimum()
| void QwtCounter::setMinimum |
( |
double |
value | ) |
|
Set the minimum value
Set the minimum value of the range
- 参数
-
- 参见
- setRange(), setMaximum(), minimum()
- 注解
- 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
- 参数
-
| numButtons | Number of buttons |
- 参见
- 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.
- 参数
-
| [in] | min | Minimum value |
| [in] | max | Maximum value |
- 参见
- minimum(), maximum()
◆ setReadOnly()
| void QwtCounter::setReadOnly |
( |
bool |
on | ) |
|
Set the counter to read only mode
Allow/disallow the user to manually edit the value
- 参数
-
- 参见
- 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
- 参数
-
- 参见
- singleStep()
◆ setStepButton1()
| void QwtCounter::setStepButton1 |
( |
int |
nSteps | ) |
|
Set the number of increment steps for button 1
- 参数
-
- 参见
- stepButton1()
◆ setStepButton2()
| void QwtCounter::setStepButton2 |
( |
int |
nSteps | ) |
|
Set the number of increment steps for button 2
- 参数
-
- 参见
- stepButton2()
◆ setStepButton3()
| void QwtCounter::setStepButton3 |
( |
int |
nSteps | ) |
|
Set the number of increment steps for button 3
- 参数
-
- 参见
- 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.
- 参数
-
| on | If true the counter will be set as valid |
- 参见
- 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.
- 参数
-
- 参见
- isValid(), value(), valueChanged()
- 警告
- 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.
- 参数
-
| on | Enable/disable wrapping |
- 参见
- wrapping()
◆ singleStep()
| double QwtCounter::singleStep |
( |
| ) |
const |
◆ 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
- 参数
-
◆ wheelEvent()
| void QwtCounter::wheelEvent |
( |
QWheelEvent * |
event | ) |
|
|
overrideprotectedvirtual |
◆ wrapping()
| bool QwtCounter::wrapping |
( |
| ) |
const |
Return true if wrapping is enabled
Return true when wrapping is set
- 参见
- setWrapping()
该类的文档由以下文件生成:
- /home/runner/work/QWT/QWT/src/plot/qwt_counter.h
- /home/runner/work/QWT/QWT/src/plot/qwt_counter.cpp