Skip to content

Commit

Permalink
Add limits to the InputField
Browse files Browse the repository at this point in the history
  • Loading branch information
jriegel committed Nov 29, 2013
1 parent 09fe84a commit b706bf7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
6 changes: 0 additions & 6 deletions src/Base/Quantity.cpp
Expand Up @@ -39,12 +39,6 @@
# pragma warning(disable : 4335) // disable MAC file format warning on VC
#endif

#ifndef DOUBLE_MAX
# define DOUBLE_MAX 1.7976931348623157E+308 /* max decimal value of a "double"*/
#endif
#ifndef DOUBLE_MIN
# define DOUBLE_MIN 2.2250738585072014E-308 /* min decimal value of a "double"*/
#endif

using namespace Base;

Expand Down
7 changes: 7 additions & 0 deletions src/Base/Quantity.h
Expand Up @@ -27,6 +27,13 @@
#include "Unit.h"
#include <QString>

#ifndef DOUBLE_MAX
# define DOUBLE_MAX 1.7976931348623157E+308 /* max decimal value of a "double"*/
#endif
#ifndef DOUBLE_MIN
# define DOUBLE_MIN 2.2250738585072014E-308 /* min decimal value of a "double"*/
#endif

namespace Base {

/**
Expand Down
20 changes: 10 additions & 10 deletions src/Gui/InputField.cpp
Expand Up @@ -40,7 +40,7 @@ using namespace Base;
// --------------------------------------------------------------------

InputField::InputField ( QWidget * parent )
: QLineEdit(parent)
: QLineEdit(parent), StepSize(1.0), Maximum(DOUBLE_MAX),Minimum(-DOUBLE_MAX)
{
this->setContextMenuPolicy(Qt::DefaultContextMenu);

Expand Down Expand Up @@ -149,37 +149,37 @@ void InputField::setUnit(const Base::Unit& unit)
/// get the value of the singleStep property
double InputField::singleStep(void)const
{
return 0.0;
return StepSize;
}

/// set the value of the singleStep property
void InputField::setSingleStep(double)
void InputField::setSingleStep(double s)
{

StepSize = s;
}

/// get the value of the maximum property
double InputField::maximum(void)const
{
return 0.0;
return Maximum;
}

/// set the value of the maximum property
void InputField::setMaximum(double)
void InputField::setMaximum(double m)
{

Maximum = m;
}

/// get the value of the minimum property
double InputField::minimum(void)const
{
return 0.0;
return Minimum;
}

/// set the value of the minimum property
void InputField::setMinimum(double)
void InputField::setMinimum(double m)
{

Minimum = m;
}


Expand Down
4 changes: 4 additions & 0 deletions src/Gui/InputField.h
Expand Up @@ -128,6 +128,10 @@ protected Q_SLOTS:

Base::Quantity actQuantity;
Base::Unit actUnit;

double Maximum;
double Minimum;
double StepSize;
};


Expand Down

0 comments on commit b706bf7

Please sign in to comment.