Add limits to the InputField

This commit is contained in:
jriegel 2013-11-29 18:24:17 +01:00
parent 09fe84abbf
commit b706bf73a5
4 changed files with 21 additions and 16 deletions

View File

@ -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;

View File

@ -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 {
/**

View File

@ -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);
@ -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;
}

View File

@ -128,6 +128,10 @@ private:
Base::Quantity actQuantity;
Base::Unit actUnit;
double Maximum;
double Minimum;
double StepSize;
};