Classes | Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | Private Slots | Private Member Functions | Private Attributes | List of all members
QwtCounter Class Reference

The Counter Widget. More...

#include <qwt_counter.h>

Inheritance diagram for QwtCounter:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Types

enum  Button { Button1, Button2, Button3, ButtonCnt }
 Button index. More...
 

Public Slots

void setValue (double)
 Set a new value without adjusting to the step raster. More...
 

Signals

void buttonReleased (double value)
 
void valueChanged (double value)
 

Public Member Functions

int incSteps (QwtCounter::Button) const
 
bool isReadOnly () const
 
bool isValid () const
 
double maximum () const
 
double minimum () const
 
int numButtons () const
 
 QwtCounter (QWidget *parent=NULL)
 
void setIncSteps (QwtCounter::Button, int numSteps)
 
void setMaximum (double)
 
void setMinimum (double)
 
void setNumButtons (int)
 
void setRange (double min, double max)
 Set the minimum and maximum values. More...
 
void setReadOnly (bool)
 Allow/disallow the user to manually edit the value. More...
 
void setSingleStep (double stepSize)
 Set the step size of the counter. More...
 
void setStepButton1 (int nSteps)
 
void setStepButton2 (int nSteps)
 
void setStepButton3 (int nSteps)
 
void setValid (bool)
 
void setWrapping (bool)
 En/Disable wrapping. More...
 
double singleStep () const
 
virtual QSize sizeHint () const QWT_OVERRIDE
 A size hint. More...
 
int stepButton1 () const
 
int stepButton2 () const
 
int stepButton3 () const
 
double value () const
 
bool wrapping () const
 
virtual ~QwtCounter ()
 Destructor. More...
 

Protected Member Functions

virtual bool event (QEvent *) QWT_OVERRIDE
 
virtual void keyPressEvent (QKeyEvent *) QWT_OVERRIDE
 
virtual void wheelEvent (QWheelEvent *) QWT_OVERRIDE
 

Properties

double maximum
 
double minimum
 
int numButtons
 
bool readOnly
 
double singleStep
 
int stepButton1
 returns the number of increment steps for button 1 More...
 
int stepButton2
 returns the number of increment steps for button 2 More...
 
int stepButton3
 returns the number of increment steps for button 3 More...
 
double value
 
bool wrapping
 

Private Slots

void btnClicked ()
 Button clicked. More...
 
void btnReleased ()
 Button released. More...
 
void textChanged ()
 Set from lineedit. More...
 

Private Member Functions

void incrementValue (int numSteps)
 
void initCounter ()
 
void showNumber (double)
 
void updateButtons ()
 Update buttons according to the current value. More...
 

Private Attributes

PrivateDatam_data
 

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

◆ 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 74 of file qwt_counter.h.

Constructor & Destructor Documentation

◆ 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
parent

Definition at line 65 of file qwt_counter.cpp.

◆ ~QwtCounter()

QwtCounter::~QwtCounter ( )
virtual

Destructor.

Definition at line 127 of file qwt_counter.cpp.

Member Function Documentation

◆ btnClicked

void QwtCounter::btnClicked ( )
privateslot

Button clicked.

Definition at line 740 of file qwt_counter.cpp.

◆ btnReleased

void QwtCounter::btnReleased ( )
privateslot

Button released.

Definition at line 753 of file qwt_counter.cpp.

◆ buttonReleased

void QwtCounter::buttonReleased ( double  value)
signal

This signal is emitted when a button has been released

Parameters
valueThe new value

◆ event()

bool QwtCounter::event ( QEvent *  event)
protectedvirtual

Handle QEvent::PolishRequest events

Parameters
eventEvent
Returns
see QWidget::event()

Definition at line 485 of file qwt_counter.cpp.

◆ incrementValue()

void QwtCounter::incrementValue ( int  numSteps)
private

Definition at line 633 of file qwt_counter.cpp.

◆ incSteps()

int QwtCounter::incSteps ( QwtCounter::Button  button) const
Returns
The number of steps by which a specified button increments the value or 0 if the button is invalid.
Parameters
buttonButton index
See also
setIncSteps()

Definition at line 416 of file qwt_counter.cpp.

◆ initCounter()

void QwtCounter::initCounter ( )
private

Definition at line 71 of file qwt_counter.cpp.

◆ isReadOnly()

bool QwtCounter::isReadOnly ( ) const
Returns
True, when the line line edit is read only. (default is no)
See also
setReadOnly()

Definition at line 186 of file qwt_counter.cpp.

◆ isValid()

bool QwtCounter::isValid ( ) const
Returns
True, if the value is valid
See also
setValid(), setValue()

Definition at line 166 of file qwt_counter.cpp.

◆ 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
eventKey event

Definition at line 524 of file qwt_counter.cpp.

◆ maximum()

double QwtCounter::maximum ( ) const

◆ minimum()

double QwtCounter::minimum ( ) const

◆ numButtons()

int QwtCounter::numButtons ( ) const

◆ setIncSteps()

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
buttonButton index
numStepsNumber of steps
See also
incSteps()

Definition at line 403 of file qwt_counter.cpp.

◆ setMaximum()

void QwtCounter::setMaximum ( double  value)

Set the maximum value of the range

Parameters
valueMaximum value
See also
setRange(), setMinimum(), maximum()

Definition at line 297 of file qwt_counter.cpp.

◆ setMinimum()

void QwtCounter::setMinimum ( double  value)

Set the minimum value of the range

Parameters
valueMinimum value
See also
setRange(), setMaximum(), minimum()
Note
The maximum is adjusted if necessary to ensure that the range remains valid.

Definition at line 277 of file qwt_counter.cpp.

◆ setNumButtons()

void QwtCounter::setNumButtons ( int  numButtons)

Specify the number of buttons on each side of the label

Parameters
numButtonsNumber of buttons
See also
numButtons()

Definition at line 362 of file qwt_counter.cpp.

◆ 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
minMinimum value
maxMaximum value
See also
minimum(), maximum()

Definition at line 241 of file qwt_counter.cpp.

◆ setReadOnly()

void QwtCounter::setReadOnly ( bool  on)

Allow/disallow the user to manually edit the value.

Parameters
onTrue disable editing
See also
isReadOnly()

Definition at line 177 of file qwt_counter.cpp.

◆ setSingleStep()

void QwtCounter::setSingleStep ( double  stepSize)

Set the step size of the counter.

A value <= 0.0 disables stepping

Parameters
stepSizeSingle step size
See also
singleStep()

Definition at line 319 of file qwt_counter.cpp.

◆ setStepButton1()

void QwtCounter::setStepButton1 ( int  nSteps)

Set the number of increment steps for button 1

Parameters
nStepsNumber of steps

Definition at line 429 of file qwt_counter.cpp.

◆ setStepButton2()

void QwtCounter::setStepButton2 ( int  nSteps)

Set the number of increment steps for button 2

Parameters
nStepsNumber of steps

Definition at line 444 of file qwt_counter.cpp.

◆ setStepButton3()

void QwtCounter::setStepButton3 ( int  nSteps)

Set the number of increment steps for button 3

Parameters
nStepsNumber of steps

Definition at line 459 of file qwt_counter.cpp.

◆ 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
onIf true the counter will be set as valid
See also
setValue(), isValid()

Definition at line 142 of file qwt_counter.cpp.

◆ 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
valueNew value
See also
isValid(), value(), valueChanged()
Warning
The value is clipped when it lies outside the range.

Definition at line 202 of file qwt_counter.cpp.

◆ 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
onEn/Disable wrapping
See also
wrapping()

Definition at line 342 of file qwt_counter.cpp.

◆ showNumber()

void QwtCounter::showNumber ( double  number)
private

Display number string

Parameters
numberNumber

Definition at line 729 of file qwt_counter.cpp.

◆ singleStep()

double QwtCounter::singleStep ( ) const

◆ sizeHint()

QSize QwtCounter::sizeHint ( ) const
virtual

A size hint.

Definition at line 759 of file qwt_counter.cpp.

◆ stepButton1()

int QwtCounter::stepButton1 ( ) const

◆ stepButton2()

int QwtCounter::stepButton2 ( ) const

◆ stepButton3()

int QwtCounter::stepButton3 ( ) const

◆ textChanged

void QwtCounter::textChanged ( )
privateslot

Set from lineedit.

Definition at line 471 of file qwt_counter.cpp.

◆ updateButtons()

void QwtCounter::updateButtons ( )
private

Update buttons according to the current value.

When the QwtCounter under- or over-flows, the focus is set to the smallest up- or down-button and counting is disabled.

Counting is re-enabled on a button release event (mouse or space bar).

Definition at line 702 of file qwt_counter.cpp.

◆ value()

double QwtCounter::value ( ) const

◆ valueChanged

void QwtCounter::valueChanged ( double  value)
signal

This signal is emitted when the counter's value has changed

Parameters
valueThe new value

◆ wheelEvent()

void QwtCounter::wheelEvent ( QWheelEvent *  event)
protectedvirtual

Handle wheel events

Parameters
eventWheel event

Definition at line 591 of file qwt_counter.cpp.

◆ wrapping()

bool QwtCounter::wrapping ( ) const

Member Data Documentation

◆ m_data

PrivateData* QwtCounter::m_data
private

Definition at line 164 of file qwt_counter.h.

Property Documentation

◆ maximum

double QwtCounter::maximum
readwrite
Returns
The maximum of the range
See also
setRange(), setMaximum(), minimum()

Definition at line 61 of file qwt_counter.h.

◆ minimum

double QwtCounter::minimum
readwrite
Returns
The minimum of the range
See also
setRange(), setMinimum(), maximum()

Definition at line 60 of file qwt_counter.h.

◆ numButtons

int QwtCounter::numButtons
readwrite
Returns
The number of buttons on each side of the widget.
See also
setNumButtons()

Definition at line 64 of file qwt_counter.h.

◆ readOnly

bool QwtCounter::readOnly
readwrite

Definition at line 69 of file qwt_counter.h.

◆ singleStep

double QwtCounter::singleStep
readwrite
Returns
Single step size
See also
setSingleStep()

Definition at line 62 of file qwt_counter.h.

◆ stepButton1

int QwtCounter::stepButton1
readwrite

returns the number of increment steps for button 1

Definition at line 65 of file qwt_counter.h.

◆ stepButton2

int QwtCounter::stepButton2
readwrite

returns the number of increment steps for button 2

Definition at line 66 of file qwt_counter.h.

◆ stepButton3

int QwtCounter::stepButton3
readwrite

returns the number of increment steps for button 3

Definition at line 67 of file qwt_counter.h.

◆ value

double QwtCounter::value
readwrite
Returns
Current value of the counter
See also
setValue(), valueChanged()

Definition at line 59 of file qwt_counter.h.

◆ wrapping

bool QwtCounter::wrapping
readwrite
Returns
True, when wrapping is set
See also
setWrapping()

Definition at line 70 of file qwt_counter.h.


The documentation for this class was generated from the following files:
QwtCounter::Button1
@ Button1
Button intended for minor steps.
Definition: qwt_counter.h:77
QwtCounter::setNumButtons
void setNumButtons(int)
Definition: qwt_counter.cpp:362
QwtCounter::setSingleStep
void setSingleStep(double stepSize)
Set the step size of the counter.
Definition: qwt_counter.cpp:319
QwtCounter::QwtCounter
QwtCounter(QWidget *parent=NULL)
Definition: qwt_counter.cpp:65
QwtCounter::Button2
@ Button2
Button intended for medium steps.
Definition: qwt_counter.h:80
QwtCounter::valueChanged
void valueChanged(double value)
qwt_counter.h
QwtCounter
The Counter Widget.
Definition: qwt_counter.h:48
QwtCounter::setRange
void setRange(double min, double max)
Set the minimum and maximum values.
Definition: qwt_counter.cpp:241
QwtCounter::setIncSteps
void setIncSteps(QwtCounter::Button, int numSteps)
Definition: qwt_counter.cpp:403


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:50