Qwt Programmer's Manual

QwtCounter


NAME

QwtCounter - The Counter Widget

SYNOPSIS

#include <qwt_counter.h>

INHERITED CLASSES

QWidget, QwtDblRange

DESCRIPTION

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.

PUBLIC MEMBERS

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

SIGNALS

buttonReleased
button released
valueChanged
value changed

EXAMPLE

      #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)));



MEMBER FUNCTION DESCRIPTION


QwtCounter::QwtCounter

Construct a QwtCounter instance

Syntax

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

Parameters

QWidget *parent
parent widget
char *name
name

Description

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

QwtCounter::~QwtCounter

Destructor

Syntax

QwtCounter::~QwtCounter()

QwtCounter::setIncSteps

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

Syntax

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

Parameters

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

QwtCounter::incSteps

Return the number of steps by which a specified button increments the value

Syntax

int QwtCounter::incSteps(QwtCounter::Button btn) const

Parameters

QwtCounter::Button btn
One of QwtCounter::Button1, QwtCounter::Button2, QwtCounter::Button3

Return Value

Number of steps or 0 if the button is invalid.

QwtCounter::setNumButtons

Specify the number of buttons on each side of the label

Syntax

void QwtCounter::setNumButtons(int n)

Parameters

int n
Number of buttons

QwtCounter::numButtons

Return the number of buttons on each side of the widget.

Syntax

int QwtCounter::numButtons() const

QwtCounter::sizeHint

Returns a recommended size for the counter.

Syntax

QSize QwtCounter::sizeHint() const

QwtCounter::buttonReleased

A signal which is emitted when a button has been released

Syntax

void QwtCounter::buttonReleased(double value)

Parameters

double value
new value

QwtCounter::valueChanged

A signal which is emitted when the counter's value has changed

Syntax

void QwtCounter::valueChanged(double value)

Parameters

double value
new value

Qwt Widget Library 01/01/98