Salome HOME
984634eef03a8777b26cbcea36546f94671745ba
[modules/geom.git] / src / GEOMGUI / GeometryGUI_SpinBox.cxx
1 using namespace std;
2 //  File      : GeometryGUI_SpinBox.cxx
3 //  Created   : 5 june 2002
4 //  Author    : Lucien PIGNOLONI
5 //  Project   : SALOME
6 //  Module    : GeometryGUI
7 //  Copyright : OPEN CASCADE
8 //  $Header$
9
10 #include "GeometryGUI_SpinBox.h"
11 #include "GeometryGUI.h"
12 #include <qvalidator.h>
13 //#include <qpushbutton.h>
14 //#include "utilities.h"
15
16 //=================================================================================
17 // class    : GeometryGUI_SpinBox()
18 // purpose  : constructor of specific widget accepting floats in double precision.
19 //=================================================================================
20 GeometryGUI_SpinBox::GeometryGUI_SpinBox( QWidget* parent, const char* name )
21 : QAD_SpinBoxDbl( parent, name)
22 {
23   /* when step value is changed in myGeomGUI */
24   connect( GeometryGUI::GetGeometryGUI(), SIGNAL( SignalDefaultStepValueChanged( double )), this, SLOT( SetStep( double ) ) );
25 }
26
27
28 //=================================================================================
29 // function : SetStep()  [SLOT]
30 // purpose  :
31 //=================================================================================
32 void GeometryGUI_SpinBox::SetStep( double newStep )
33 {
34   setLineStep( newStep );
35 }
36
37 //=================================================================================
38 // function : ~GeometryGUI_SpinBox()
39 // purpose  : destructor
40 //=================================================================================
41 GeometryGUI_SpinBox::~GeometryGUI_SpinBox()
42 {
43 }
44
45 //=================================================================================
46 // function : SetValue()
47 // purpose  :
48 //=================================================================================
49 void GeometryGUI_SpinBox::SetValue( double v )
50 {
51   setValue( v );
52 }
53
54 //=================================================================================
55 // function : GetValue()
56 // purpose  : returns a double
57 //=================================================================================
58 double GeometryGUI_SpinBox::GetValue( )
59 {
60   return value();
61 }
62
63 //=================================================================================
64 // function : GetString()
65 // purpose  : returns a QString
66 //=================================================================================
67 QString GeometryGUI_SpinBox::GetString( )
68 {
69   return cleanText();
70 }
71
72 //=================================================================================
73 // function : RangeStepAndValidator()
74 // purpose  :
75 //=================================================================================
76 void GeometryGUI_SpinBox::RangeStepAndValidator( double min, double max, double step, unsigned short decimals )
77 {
78   setRange( min, max );
79   setLineStep( step );
80   ( ( QDoubleValidator* )validator() )->setRange( min, max, decimals ) ;
81 }