Do not overwrite tooltips for InputFields.

This commit is contained in:
Markus Lampert
2017-08-19 16:21:20 -07:00
committed by wmayer
parent ca4488f438
commit 71130d09ed
2 changed files with 2 additions and 10 deletions

View File

@@ -253,11 +253,10 @@ void InputField::newInput(const QString & text)
res = Quantity::parse(input);
}
catch(Base::Exception &e){
ErrorText = e.what();
this->setToolTip(QString::fromLatin1(ErrorText.c_str()));
QString errorText = QString::fromLatin1(e.what());
QPixmap pixmap = getValidationIcon(":/icons/button_invalid.svg", QSize(sizeHint().height(),sizeHint().height()));
iconLabel->setPixmap(pixmap);
parseError(QString::fromLatin1(ErrorText.c_str()));
parseError(errorText);
validInput = false;
return;
}
@@ -267,7 +266,6 @@ void InputField::newInput(const QString & text)
// check if unit fits!
if(!actUnit.isEmpty() && !res.getUnit().isEmpty() && actUnit != res.getUnit()){
this->setToolTip(QString::fromLatin1("Wrong unit"));
QPixmap pixmap = getValidationIcon(":/icons/button_invalid.svg", QSize(sizeHint().height(),sizeHint().height()));
iconLabel->setPixmap(pixmap);
parseError(QString::fromLatin1("Wrong unit"));
@@ -278,20 +276,15 @@ void InputField::newInput(const QString & text)
QPixmap pixmap = getValidationIcon(":/icons/button_valid.svg", QSize(sizeHint().height(),sizeHint().height()));
iconLabel->setPixmap(pixmap);
ErrorText = "";
validInput = true;
if (res.getValue() > Maximum){
res.setValue(Maximum);
ErrorText = "Maximum reached";
}
if (res.getValue() < Minimum){
res.setValue(Minimum);
ErrorText = "Minimum reached";
}
this->setToolTip(QString::fromLatin1(ErrorText.c_str()));
double dFactor;
res.getUserString(dFactor,actUnitStr);
actUnitValue = res.getValue()/dFactor;