.TH "QwtCounter" 3 "Mon Aug 1 2011" "Version 5.2.2" "Qwt User's Guide" \" -*- nroff -*- .ad l .nh .SH NAME QwtCounter \- .PP The Counter Widget. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBQwtDoubleRange\fP. .SS "Public Types" .in +1c .ti -1c .RI "enum \fBButton\fP { \fBButton1\fP, \fBButton2\fP, \fBButton3\fP, \fBButtonCnt\fP }" .br .in -1c .SS "Signals" .in +1c .ti -1c .RI "void \fBbuttonReleased\fP (double value)" .br .ti -1c .RI "void \fBvalueChanged\fP (double value)" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "bool \fBeditable\fP () const " .br .ti -1c .RI "virtual void \fBfitValue\fP (double)" .br .ti -1c .RI "virtual void \fBincPages\fP (int)" .br .ti -1c .RI "int \fBincSteps\fP (\fBQwtCounter::Button\fP btn) const " .br .ti -1c .RI "virtual void \fBincValue\fP (int)" .br .ti -1c .RI "bool \fBisValid\fP () const " .br .ti -1c .RI "double \fBmaxVal\fP () const " .br .ti -1c .RI "double \fBmaxValue\fP () const " .br .ti -1c .RI "double \fBminVal\fP () const " .br .ti -1c .RI "double \fBminValue\fP () const " .br .ti -1c .RI "int \fBnumButtons\fP () const " .br .ti -1c .RI "int \fBpageSize\fP () const " .br .ti -1c .RI "bool \fBperiodic\fP () const " .br .ti -1c .RI "virtual void \fBpolish\fP ()" .br .ti -1c .RI "\fBQwtCounter\fP (QWidget *parent=NULL)" .br .ti -1c .RI "void \fBsetEditable\fP (bool)" .br .ti -1c .RI "void \fBsetIncSteps\fP (\fBQwtCounter::Button\fP btn, int nSteps)" .br .ti -1c .RI "void \fBsetMaxValue\fP (double m)" .br .ti -1c .RI "void \fBsetMinValue\fP (double m)" .br .ti -1c .RI "void \fBsetNumButtons\fP (int n)" .br .ti -1c .RI "void \fBsetPeriodic\fP (bool tf)" .br .ti -1c .RI "void \fBsetRange\fP (double vmin, double vmax, double vstep=0.0, int pagesize=1)" .br .ti -1c .RI "void \fBsetStep\fP (double s)" .br .ti -1c .RI "void \fBsetStepButton1\fP (int nSteps)" .br .ti -1c .RI "void \fBsetStepButton2\fP (int nSteps)" .br .ti -1c .RI "void \fBsetStepButton3\fP (int nSteps)" .br .ti -1c .RI "void \fBsetValid\fP (bool)" .br .ti -1c .RI "virtual void \fBsetValue\fP (double)" .br .ti -1c .RI "virtual QSize \fBsizeHint\fP () const " .br .ti -1c .RI "double \fBstep\fP () const " .br .ti -1c .RI "int \fBstepButton1\fP () const " .br .ti -1c .RI "int \fBstepButton2\fP () const " .br .ti -1c .RI "int \fBstepButton3\fP () const " .br .ti -1c .RI "virtual double \fBvalue\fP () const " .br .ti -1c .RI "virtual \fB~QwtCounter\fP ()" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual bool \fBevent\fP (QEvent *)" .br .ti -1c .RI "double \fBexactPrevValue\fP () const " .br .ti -1c .RI "double \fBexactValue\fP () const " .br .ti -1c .RI "virtual void \fBkeyPressEvent\fP (QKeyEvent *)" .br .ti -1c .RI "double \fBprevValue\fP () const " .br .ti -1c .RI "virtual void \fBrangeChange\fP ()" .br .ti -1c .RI "virtual void \fBstepChange\fP ()" .br .ti -1c .RI "virtual void \fBwheelEvent\fP (QWheelEvent *)" .br .in -1c .SH "Detailed Description" .PP 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. .PP 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 \fBQwtCounter::setIncSteps()\fP. The number of buttons can be changed with \fBQwtCounter::setNumButtons()\fP. .PP Holding the space bar down with focus on a button is the fastest method to step through the counter values. When the counter underflows/overflows, the focus is set to the smallest up/down button and counting is disabled. Counting is re-enabled on a button release event (mouse or space bar). .PP Example: .PP .nf #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))); .fi .PP .SH "Member Enumeration Documentation" .PP .SS "enum \fBQwtCounter::Button\fP"Button index .SH "Constructor & Destructor Documentation" .PP .SS "QwtCounter::QwtCounter (QWidget *parent = \fCNULL\fP)\fC [explicit]\fP"The default number of buttons is set to 2. The default increments are: .PD 0 .IP "\(bu" 2 Button 1: 1 step .IP "\(bu" 2 Button 2: 10 steps .IP "\(bu" 2 Button 3: 100 steps .PP \fBParameters:\fP .RS 4 \fIparent\fP .RE .PP .SS "QwtCounter::~QwtCounter ()\fC [virtual]\fP" .PP Destructor. .SH "Member Function Documentation" .PP .SS "void QwtCounter::buttonReleased (doublevalue)\fC [signal]\fP"This signal is emitted when a button has been released .PP \fBParameters:\fP .RS 4 \fIvalue\fP The new value .RE .PP .SS "bool QwtCounter::editable () const" .PP returns whether the line edit is edatble. (default is yes) .SS "bool QwtCounter::event (QEvent *e)\fC [protected, virtual]\fP"Handle PolishRequest events .SS "double QwtDoubleRange::exactPrevValue () const\fC [protected, inherited]\fP" .PP Returns the exact previous value. .SS "double QwtDoubleRange::exactValue () const\fC [protected, inherited]\fP" .PP Returns the exact value. The exact value is the value which \fBQwtDoubleRange::value\fP would return if the value were not adjusted to the step raster. It differs from the current value only if \fBQwtDoubleRange::fitValue\fP or \fBQwtDoubleRange::incValue\fP have been used before. This function is intended for internal use in derived classes. .SS "void QwtDoubleRange::fitValue (doublex)\fC [virtual, inherited]\fP" .PP Adjust the value to the closest point in the step raster. \fBParameters:\fP .RS 4 \fIx\fP value .RE .PP \fBWarning:\fP .RS 4 The value is clipped when it lies outside the range. When the range is \fBQwtDoubleRange::periodic\fP, it will be mapped to a point in the interval such that .PP .nf new value := x + n * (max. value - min. value) .fi .PP with an integer number n. .RE .PP .PP Reimplemented in \fBQwtAbstractSlider\fP. .SS "void QwtDoubleRange::incPages (intnPages)\fC [virtual, inherited]\fP" .PP Increment the value by a specified number of pages. \fBParameters:\fP .RS 4 \fInPages\fP Number of pages to increment. A negative number decrements the value. .RE .PP \fBWarning:\fP .RS 4 The Page size is specified in the constructor. .RE .PP .SS "int QwtCounter::incSteps (\fBQwtCounter::Button\fPbtn) const"\fBReturns:\fP .RS 4 the number of steps by which a specified button increments the value or 0 if the button is invalid. .RE .PP \fBParameters:\fP .RS 4 \fIbtn\fP One of \fCQwtCounter::Button1\fP, \fCQwtCounter::Button2\fP, \fCQwtCounter::Button3\fP .RE .PP .SS "void QwtDoubleRange::incValue (intnSteps)\fC [virtual, inherited]\fP" .PP Increment the value by a specified number of steps. \fBParameters:\fP .RS 4 \fInSteps\fP Number of steps to increment .RE .PP \fBWarning:\fP .RS 4 As a result of this operation, the new value will always be adjusted to the step raster. .RE .PP .PP Reimplemented in \fBQwtAbstractSlider\fP. .SS "bool QwtDoubleRange::isValid () const\fC [inherited]\fP" .PP Indicates if the value is valid. .PP Reimplemented in \fBQwtAbstractSlider\fP. .SS "void QwtCounter::keyPressEvent (QKeyEvent *e)\fC [protected, virtual]\fP"Handle key events .PP .IP "\(bu" 2 Ctrl + Qt::Key_Home Step to \fBminValue()\fP .IP "\(bu" 2 Ctrl + Qt::Key_End Step to \fBmaxValue()\fP .IP "\(bu" 2 Qt::Key_Up Increment by incSteps(QwtCounter::Button1) .IP "\(bu" 2 Qt::Key_Down Decrement by incSteps(QwtCounter::Button1) .IP "\(bu" 2 Qt::Key_PageUp Increment by incSteps(QwtCounter::Button2) .IP "\(bu" 2 Qt::Key_PageDown Decrement by incSteps(QwtCounter::Button2) .IP "\(bu" 2 Shift + Qt::Key_PageUp Increment by incSteps(QwtCounter::Button3) .IP "\(bu" 2 Shift + Qt::Key_PageDown Decrement by incSteps(QwtCounter::Button3) .PP .SS "double QwtCounter::maxVal () const" .PP returns the maximum value of the range .SS "double QwtDoubleRange::maxValue () const\fC [inherited]\fP" .PP Returns the value of the second border of the range. maxValue returns the value which has been specified as the second parameter in \fBQwtDoubleRange::setRange\fP. .PP \fBSee also:\fP .RS 4 \fBsetRange()\fP .RE .PP .SS "double QwtCounter::minVal () const" .PP returns the minimum value of the range .SS "double QwtDoubleRange::minValue () const\fC [inherited]\fP" .PP Returns the value at the first border of the range. minValue returns the value which has been specified as the first parameter in \fBsetRange()\fP. .PP \fBSee also:\fP .RS 4 \fBsetRange()\fP .RE .PP .SS "int QwtCounter::numButtons () const"\fBReturns:\fP .RS 4 The number of buttons on each side of the widget. .RE .PP .SS "int QwtDoubleRange::pageSize () const\fC [inherited]\fP" .PP Returns the page size in steps. .SS "bool QwtDoubleRange::periodic () const\fC [inherited]\fP" .PP Returns true if the range is periodic. \fBSee also:\fP .RS 4 \fBsetPeriodic()\fP .RE .PP .SS "void QwtCounter::polish ()\fC [virtual]\fP"Sets the minimum width for the buttons .SS "double QwtDoubleRange::prevValue () const\fC [protected, inherited]\fP" .PP Returns the previous value. .SS "void QwtCounter::rangeChange ()\fC [protected, virtual]\fP" .PP Notify change of range. This function updates the enabled property of all buttons contained in \fBQwtCounter\fP. .PP Reimplemented from \fBQwtDoubleRange\fP. .SS "void QwtCounter::setEditable (booleditable)" .PP Allow/disallow the user to manually edit the value. \fBParameters:\fP .RS 4 \fIeditable\fP true enables editing .RE .PP \fBSee also:\fP .RS 4 \fBeditable()\fP .RE .PP .SS "void QwtCounter::setIncSteps (\fBQwtCounter::Button\fPbtn, intnSteps)"Specify the number of steps by which the value is incremented or decremented when a specified button is pushed. .PP \fBParameters:\fP .RS 4 \fIbtn\fP One of \fCQwtCounter::Button1\fP, \fCQwtCounter::Button2\fP, \fCQwtCounter::Button3\fP .br \fInSteps\fP Number of steps .RE .PP .SS "void QwtCounter::setMaxValue (doublevalue)"Set the maximum value of the range .PP \fBParameters:\fP .RS 4 \fIvalue\fP Maximum value .RE .PP \fBSee also:\fP .RS 4 \fBsetMinValue()\fP, \fBmaxVal()\fP .RE .PP .SS "void QwtCounter::setMinValue (doublevalue)"Set the minimum value of the range .PP \fBParameters:\fP .RS 4 \fIvalue\fP Minimum value .RE .PP \fBSee also:\fP .RS 4 \fBsetMaxValue()\fP, \fBminVal()\fP .RE .PP .SS "void QwtCounter::setNumButtons (intn)" .PP Specify the number of buttons on each side of the label. \fBParameters:\fP .RS 4 \fIn\fP Number of buttons .RE .PP .SS "void QwtDoubleRange::setPeriodic (booltf)\fC [inherited]\fP" .PP Make the range periodic. When the range is periodic, the value will be set to a point inside the interval such that .PP .PP .nf point = value + n * width .fi .PP .PP if the user tries to set a new value which is outside the range. If the range is nonperiodic (the default), values outside the range will be clipped. .PP \fBParameters:\fP .RS 4 \fItf\fP true for a periodic range .RE .PP .SS "void QwtDoubleRange::setRange (doublevmin, doublevmax, doublevstep = \fC0.0\fP, intpageSize = \fC1\fP)\fC [inherited]\fP" .PP Specify range and step size. \fBParameters:\fP .RS 4 \fIvmin\fP lower boundary of the interval .br \fIvmax\fP higher boundary of the interval .br \fIvstep\fP step width .br \fIpageSize\fP page size in steps .RE .PP \fBWarning:\fP .RS 4 .PD 0 .IP "\(bu" 2 A change of the range changes the value if it lies outside the new range. The current value will *not* be adjusted to the new step raster. .IP "\(bu" 2 vmax < vmin is allowed. .IP "\(bu" 2 If the step size is left out or set to zero, it will be set to 1/100 of the interval length. .IP "\(bu" 2 If the step size has an absurd value, it will be corrected to a better one. .PP .RE .PP .SS "void QwtCounter::setStep (doublestepSize)"Set the step size .PP \fBParameters:\fP .RS 4 \fIstepSize\fP Step size .RE .PP \fBSee also:\fP .RS 4 \fBQwtDoubleRange::setStep()\fP .RE .PP .PP Reimplemented from \fBQwtDoubleRange\fP. .SS "void QwtCounter::setStepButton1 (intnSteps)"Set the number of increment steps for button 1 .PP \fBParameters:\fP .RS 4 \fInSteps\fP Number of steps .RE .PP .SS "void QwtCounter::setStepButton2 (intnSteps)"Set the number of increment steps for button 2 .PP \fBParameters:\fP .RS 4 \fInSteps\fP Number of steps .RE .PP .SS "void QwtCounter::setStepButton3 (intnSteps)"Set the number of increment steps for button 3 .PP \fBParameters:\fP .RS 4 \fInSteps\fP Number of steps .RE .PP .SS "void QwtDoubleRange::setValid (boolisValid)\fC [inherited]\fP" .PP Set the value to be valid/invalid. .PP Reimplemented in \fBQwtAbstractSlider\fP. .SS "void QwtCounter::setValue (doublev)\fC [virtual]\fP" .PP Set a new value. \fBParameters:\fP .RS 4 \fIv\fP new value Calls \fBQwtDoubleRange::setValue\fP and does all visual updates. .RE .PP \fBSee also:\fP .RS 4 \fBQwtDoubleRange::setValue()\fP .RE .PP .PP Reimplemented from \fBQwtDoubleRange\fP. .SS "QSize QwtCounter::sizeHint () const\fC [virtual]\fP" .PP A size hint. .SS "double QwtCounter::step () const" .PP returns the step size .PP Reimplemented from \fBQwtDoubleRange\fP. .SS "int QwtCounter::stepButton1 () const" .PP returns the number of increment steps for button 1 .SS "int QwtCounter::stepButton2 () const" .PP returns the number of increment steps for button 2 .SS "int QwtCounter::stepButton3 () const" .PP returns the number of increment steps for button 3 .SS "void QwtDoubleRange::stepChange ()\fC [protected, virtual, inherited]\fP" .PP Notify a change of the step size. This virtual function is called whenever the step size changes. The default implementation does nothing. .SS "double QwtCounter::value () const\fC [virtual]\fP"\fBReturns:\fP .RS 4 Current value .RE .PP .PP Reimplemented from \fBQwtDoubleRange\fP. .SS "void QwtCounter::valueChanged (doublevalue)\fC [signal]\fP"This signal is emitted when the counter's value has changed .PP \fBParameters:\fP .RS 4 \fIvalue\fP The new value .RE .PP .SS "void QwtCounter::wheelEvent (QWheelEvent *e)\fC [protected, virtual]\fP"Handle wheel events .PP \fBParameters:\fP .RS 4 \fIe\fP Wheel event .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Qwt User's Guide from the source code.