QwtCounter(3) | Qwt User's Guide | QwtCounter(3) |
NAME
QwtCounter - The Counter Widget.
SYNOPSIS
#include <qwt_counter.h>
Inherits QWidget.
Public Types
enum Button { Button1, Button2,
Button3, ButtonCnt }
Button index.
Public Slots
void setValue (double)
Set a new value without adjusting to the step raster.
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. bool wrapping () const
bool isReadOnly () const
void setReadOnly (bool)
Allow/disallow the user to manually edit the value. void setNumButtons
(int)
int numButtons () const
void setIncSteps (QwtCounter::Button, int numSteps)
int incSteps (QwtCounter::Button) const
virtual QSize sizeHint () const 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)
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 *) override
virtual void wheelEvent (QWheelEvent *) override
virtual void keyPressEvent (QKeyEvent *) override
Detailed Description
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> QwtCounter *counter = new QwtCounter(parent); counter->setRange(0.0, 100.0); // From 0.0 to 100 counter->setSingleStep( 1.0 ); // Step size 1.0 counter->setNumButtons(2); // Two buttons each side counter->setIncSteps(QwtCounter::Button1, 1); // Button 1 increments 1 step counter->setIncSteps(QwtCounter::Button2, 20); // Button 2 increments 20 steps connect(counter, SIGNAL(valueChanged(double)), myClass, SLOT(newValue(double)));
Definition at line 48 of file qwt_counter.h.
Member Enumeration Documentation
enum QwtCounter::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.
Definition at line 67 of file qwt_counter.h.
Constructor & Destructor Documentation
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
Definition at line 65 of file qwt_counter.cpp.
Member Function Documentation
void QwtCounter::buttonReleased (double value) [signal]
This signal is emitted when a button has been released
Parameters
bool QwtCounter::event (QEvent * event) [override], [protected], [virtual]
Handle QEvent::PolishRequest events
Parameters
Returns
Definition at line 485 of file qwt_counter.cpp.
int QwtCounter::incSteps (QwtCounter::Button button) const
Returns
Parameters
See also
Definition at line 416 of file qwt_counter.cpp.
bool QwtCounter::isReadOnly () const
Returns
See also
Definition at line 186 of file qwt_counter.cpp.
bool QwtCounter::isValid () const
Returns
See also
Definition at line 166 of file qwt_counter.cpp.
void QwtCounter::keyPressEvent (QKeyEvent * event) [override], [protected], [virtual]
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
Definition at line 524 of file qwt_counter.cpp.
double QwtCounter::maximum () const
Returns
See also
Definition at line 306 of file qwt_counter.cpp.
double QwtCounter::minimum () const
Returns
See also
Definition at line 286 of file qwt_counter.cpp.
int QwtCounter::numButtons () const
Returns
See also
Definition at line 388 of file qwt_counter.cpp.
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.
Parameters
numSteps Number of steps
See also
Definition at line 403 of file qwt_counter.cpp.
void QwtCounter::setMaximum (double value)
Set the maximum value of the range
Parameters
See also
Definition at line 297 of file qwt_counter.cpp.
void QwtCounter::setMinimum (double value)
Set the minimum value of the range
Parameters
See also
Note
Definition at line 277 of file qwt_counter.cpp.
void QwtCounter::setNumButtons (int numButtons)
Specify the number of buttons on each side of the label
Parameters
See also
Definition at line 362 of file qwt_counter.cpp.
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
max Maximum value
See also
Definition at line 241 of file qwt_counter.cpp.
void QwtCounter::setReadOnly (bool on)
Allow/disallow the user to manually edit the value.
Parameters
See also
Definition at line 177 of file qwt_counter.cpp.
void QwtCounter::setSingleStep (double stepSize)
Set the step size of the counter. A value <= 0.0 disables stepping
Parameters
See also
Definition at line 319 of file qwt_counter.cpp.
void QwtCounter::setStepButton1 (int nSteps)
Set the number of increment steps for button 1
Parameters
Definition at line 429 of file qwt_counter.cpp.
void QwtCounter::setStepButton2 (int nSteps)
Set the number of increment steps for button 2
Parameters
Definition at line 444 of file qwt_counter.cpp.
void QwtCounter::setStepButton3 (int nSteps)
Set the number of increment steps for button 3
Parameters
Definition at line 459 of file qwt_counter.cpp.
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
See also
Definition at line 142 of file qwt_counter.cpp.
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
Warning
Definition at line 202 of file qwt_counter.cpp.
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
Definition at line 342 of file qwt_counter.cpp.
double QwtCounter::singleStep () const
Returns
See also
Definition at line 328 of file qwt_counter.cpp.
double QwtCounter::value () const
Returns
See also
Definition at line 225 of file qwt_counter.cpp.
void QwtCounter::valueChanged (double value) [signal]
This signal is emitted when the counter's value has changed
Parameters
void QwtCounter::wheelEvent (QWheelEvent * event) [override], [protected], [virtual]
Handle wheel events
Parameters
Definition at line 591 of file qwt_counter.cpp.
bool QwtCounter::wrapping () const
Returns
See also
Definition at line 351 of file qwt_counter.cpp.
Author
Generated automatically by Doxygen for Qwt User's Guide from the source code.
Sun Jul 18 2021 | Version 6.2.0 |