Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

QwtCounter Class Reference

The Counter Widget. More...

#include <qwt_counter.h>

Inheritance diagram for QwtCounter::

QwtDblRange List of all members.

Public Types

enum  Button { Button1, Button2, Button3, ButtonCnt }

Signals

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

Public Methods

 QwtCounter (QWidget *parent=0, char *name=0)
 ~QwtCounter ()
void setNumButtons (int n)
void setIncSteps (QwtCounter::Button btn, int nSteps)
int incSteps (QwtCounter::Button btn) const
int numButtons () const
void setEnabled (bool tf)
QSize sizeHint () const

Protected Methods

void fontChange (const QFont &f)
void resizeEvent (QResizeEvent *e)
void timerEvent (QTimerEvent *e)

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. 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 @QwtCounter::setIncSteps@. The number of buttons can be changed with setNumButtons().

Example:

#include "../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)));


Constructor & Destructor Documentation

QwtCounter::QwtCounter QWidget *    parent = 0,
char *    name = 0
 

ctor.

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 
name  Forwarded to QWidget's ctor.

QwtCounter::~QwtCounter  
 

dtor.


Member Function Documentation

void QwtCounter::buttonReleased double    value [signal]
 

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

Parameters:
value  The new value

void QwtCounter::fontChange const QFont &    f [protected]
 

Notify change of font.

This function updates the fonts of all widgets contained in QwtCounter.

Parameters:
f  new font

int QwtCounter::incSteps QwtCounter::Button    btn const
 

Returns:
the number of steps by which a specified button increments the value or 0 if the button is invalid.
Parameters:
btn  One of QwtCounter::Button1, QwtCounter::Button2, QwtCounter::Button3

int QwtCounter::numButtons   const
 

Returns:
The number of buttons on each side of the widget.

void QwtCounter::resizeEvent QResizeEvent *    e [protected]
 

Resize the counter.

Parameters:
e  Todo...

void QwtCounter::setEnabled bool    tf
 

Activates/deactivates user input.

Parameters:
tf  enabled/disabled

void QwtCounter::setIncSteps QwtCounter::Button    btn,
int    nSteps
 

Specify the number of steps by which the value is incremented or decremented when a specified button is pushed.

Parameters:
btn  One of QwtCounter::Button1, QwtCounter::Button2, QwtCounter::Button3
nSteps  Number of steps

void QwtCounter::setNumButtons int    n
 

Specify the number of buttons on each side of the label.

Parameters:
n  Number of buttons

QSize QwtCounter::sizeHint   const
 

Returns:
A recommended size for the counter.

void QwtCounter::timerEvent QTimerEvent *    e [protected]
 

Timer event handler.

A timer event occurs when a mouse is pressed and hold down on one of the buttons. The default implementation increments the counter's value.

Parameters:
e  Todo...

void QwtCounter::valueChanged double    value [signal]
 

This signal is emitted when a button has been released

Parameters:
value  The new value


The documentation for this class was generated from the following files:
Generated on Mon Oct 22 18:38:31 2001 for Qwt User's Guide by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001