Qwt Programmer's Manual
QwtCounter
QwtCounter - The Counter Widget
#include <qwt_counter.h>
QWidget, QwtDblRange
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 setIncSteps.
The number of buttons can be changed with
setNumButtons.
- QwtCounter
- Constructor
- ~QwtCounter
- Destructor
- setNumButtons
- Specify number of buttons
- setIncSteps
- Specify increment steps for a button
- incSteps
- Return increment steps for a button
- numButtons
- Return number of buttons
- sizeHint
- Size Hint
- buttonReleased
- button released
- valueChanged
- value changed
#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)));
Construct a QwtCounter instance
QwtCounter::QwtCounter(QWidget *parent = 0, char *name = 0)
- QWidget *parent
- parent widget
- char *name
- name
The default number of buttons is set to 2. The default
increments are
- Button 1:
- one step
- Button 2:
- 10 steps
- Button 3:
- 100 steps
Destructor
QwtCounter::~QwtCounter()
Specify the number of steps by which the value
is incremented or decremented when a specified button
is pushed.
void QwtCounter::setIncSteps(QwtCounter::Button btn, int nSteps)
- QwtCounter::Button btn
- One of QwtCounter::Button1,
QwtCounter::Button2, QwtCounter::Button3
- int nSteps
- Number of steps
Return the number of steps by which a specified button
increments the value
int QwtCounter::incSteps(QwtCounter::Button btn) const
- QwtCounter::Button btn
- One of QwtCounter::Button1,
QwtCounter::Button2, QwtCounter::Button3
Number of steps or 0 if the button is invalid.
Specify the number of buttons on each side of the label
void QwtCounter::setNumButtons(int n)
- int n
- Number of buttons
Return the number of buttons on each side of the widget.
int QwtCounter::numButtons() const
Returns a recommended size for the counter.
QSize QwtCounter::sizeHint() const
A signal which is emitted when a button has been released
void QwtCounter::buttonReleased(double value)
- double value
- new value
A signal which is emitted when the counter's value has changed
void QwtCounter::valueChanged(double value)
- double value
- new value
Qwt Widget Library 01/01/98