Skip to content

Commit

Permalink
Fix unit error checking in InputField
Browse files Browse the repository at this point in the history
  • Loading branch information
jriegel committed Apr 17, 2014
1 parent faf406f commit 280448e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Gui/InputField.cpp
Expand Up @@ -163,6 +163,16 @@ void InputField::newInput(const QString & text)
return;
}

// check if unit fits!
if(!actUnit.isEmpty() && !res.getUnit().isEmpty() && actUnit != res.getUnit()){
this->setToolTip(QString::fromAscii("Wrong unit"));
QPixmap pixmap = BitmapFactory().pixmapFromSvg(":/icons/button_invalid.svg", QSize(sizeHint().height(),sizeHint().height()));
iconLabel->setPixmap(pixmap);
parseError(QString::fromAscii("Wrong unit"));
return;
}


QPixmap pixmap = BitmapFactory().pixmapFromSvg(":/icons/button_valid.svg", QSize(sizeHint().height(),sizeHint().height()));
iconLabel->setPixmap(pixmap);
ErrorText = "";
Expand Down

0 comments on commit 280448e

Please sign in to comment.