QXRD  0.11.16
Public Member Functions | List of all members
QxrdCenterStepSpinner Class Reference

#include <qxrdcenterstepspinner.h>

Inheritance diagram for QxrdCenterStepSpinner:
Inheritance graph
[legend]
Collaboration diagram for QxrdCenterStepSpinner:
Collaboration graph
[legend]

Public Member Functions

 QxrdCenterStepSpinner (QWidget *parent=0)
 
virtual void stepBy (int steps)
 

Detailed Description

Definition at line 7 of file qxrdcenterstepspinner.h.

Constructor & Destructor Documentation

QxrdCenterStepSpinner::QxrdCenterStepSpinner ( QWidget *  parent = 0)
explicit

Definition at line 5 of file qxrdcenterstepspinner.cpp.

5  :
6  QDoubleSpinBox(parent)
7 {
8  setDecimals(5);
9 }

Member Function Documentation

void QxrdCenterStepSpinner::stepBy ( int  steps)
virtual

Definition at line 11 of file qxrdcenterstepspinner.cpp.

12 {
13  double newVal = value();
14  double sgn = (newVal < 0 ? -1 : 1);
15  double logVal = log10(fabs(newVal));
16  double frac = logVal - floor(logVal);
17 
18 // printf("frac = %g\n", frac);
19  double mul;
20  if (frac < 0.2) {
21  mul = (steps > 0 ? 2.0 : 2.0);
22  } else if (frac < 0.5) {
23  mul = (steps > 0 ? 2.5 : 2.0);
24  } else {
25  mul = (steps > 0 ? 2.0 : 2.5);
26  }
27 
28 
29  if (steps > 0) {
30  if (newVal == 0) {
31  newVal = 0.00001;
32  } else {
33  newVal *= mul;
34  }
35  } else if (steps < 0) {
36  newVal /= mul;
37  }
38 
39  setValue(newVal*sgn);
40 //
41 // emit valueChanged(newVal);
42 }

The documentation for this class was generated from the following files: