Skip to content

Commit

Permalink
Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Apr 14, 2014
2 parents 0d7d568 + 384778e commit 1a11636
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions src/Gui/InputField.cpp
Expand Up @@ -149,14 +149,14 @@ void InputField::newInput(const QString & text)
iconLabel->setPixmap(pixmap);
ErrorText = "";

if (res.getValue() > Maximum){
res.setValue(Maximum);
ErrorText = "Maximum reached";
}
if (res.getValue() < Minimum){
res.setValue(Minimum);
ErrorText = "Minimum reached";
}
if (res.getValue() > Maximum){
res.setValue(Maximum);
ErrorText = "Maximum reached";
}
if (res.getValue() < Minimum){
res.setValue(Minimum);
ErrorText = "Minimum reached";
}

this->setToolTip(QString::fromAscii(ErrorText.c_str()));
actQuantity = res;
Expand Down Expand Up @@ -224,7 +224,6 @@ void InputField::setToLastUsedValue(void)
this->setValue(Base::Quantity::parse(hist[0]));
}


void InputField::pushToSavedValues(const QString &valueq)
{
std::string value;
Expand Down Expand Up @@ -269,10 +268,9 @@ std::vector<QString> InputField::getSavedValues(void)
/** Sets the preference path to \a path. */
void InputField::setParamGrpPath( const QByteArray& path )
{

_handle = App::GetApplication().GetParameterGroupByPath( path);
if (_handle.isValid())
sGroupString = (const char*)path;
_handle = App::GetApplication().GetParameterGroupByPath( path);
if (_handle.isValid())
sGroupString = (const char*)path;
}

/** Returns the widget's preferences path. */
Expand All @@ -287,13 +285,13 @@ QByteArray InputField::paramGrpPath() const
void InputField::setValue(const Base::Quantity& quant)
{
actQuantity = quant;
// check limits
if (actQuantity.getValue() > Maximum)
actQuantity.setValue(Maximum);
if (actQuantity.getValue() < Minimum)
actQuantity.setValue(Minimum);
// check limits
if (actQuantity.getValue() > Maximum)
actQuantity.setValue(Maximum);
if (actQuantity.getValue() < Minimum)
actQuantity.setValue(Minimum);

if(!quant.getUnit().isEmpty())
if (!quant.getUnit().isEmpty())
actUnit = quant.getUnit();

double dFactor;
Expand All @@ -306,8 +304,6 @@ void InputField::setUnit(const Base::Unit& unit)
actUnit = unit;
}



/// get the value of the singleStep property
double InputField::singleStep(void)const
{
Expand All @@ -330,8 +326,8 @@ double InputField::maximum(void)const
void InputField::setMaximum(double m)
{
Maximum = m;
if (actQuantity.getValue() > Maximum)
actQuantity.setValue(Maximum);
if (actQuantity.getValue() > Maximum)
actQuantity.setValue(Maximum);
}

/// get the value of the minimum property
Expand All @@ -344,16 +340,16 @@ double InputField::minimum(void)const
void InputField::setMinimum(double m)
{
Minimum = m;
if (actQuantity.getValue() < Minimum)
actQuantity.setValue(Minimum);
if (actQuantity.getValue() < Minimum)
actQuantity.setValue(Minimum);
}

void InputField::setUnitText(QString str)
{
Base::Quantity quant = Base::Quantity::parse(str);
setUnit(quant.getUnit());
}

QString InputField::getUnitText(void)
{
return actUnitStr;
Expand All @@ -364,6 +360,7 @@ int InputField::historySize(void)const
{
return HistorySize;
}

// set the value of the minimum property
void InputField::setHistorySize(int i)
{
Expand All @@ -382,7 +379,6 @@ void InputField::selectNumber(void)
i++;

setSelection(0,i);

}

void InputField::keyPressEvent(QKeyEvent *event)
Expand Down Expand Up @@ -416,6 +412,7 @@ void InputField::wheelEvent (QWheelEvent * event)
this->setText( QString::fromUtf8("%L1 %2").arg(val).arg(actUnitStr));
event->accept();
}

// --------------------------------------------------------------------


Expand Down

0 comments on commit 1a11636

Please sign in to comment.