+ fix whitespaces and a few minor things
This commit is contained in:
parent
f1762edd6c
commit
30e5321e76
|
@ -46,8 +46,8 @@ using namespace Base;
|
|||
using namespace std;
|
||||
|
||||
|
||||
const PropertyQuantityConstraint::Constraints LengthStandart = {0.0,(double)INT_MAX,1.0};
|
||||
const PropertyQuantityConstraint::Constraints AngleStandart = {-360,360,1.0};
|
||||
const PropertyQuantityConstraint::Constraints LengthStandard = {0.0,(double)INT_MAX,1.0};
|
||||
const PropertyQuantityConstraint::Constraints AngleStandard = {-360,360,1.0};
|
||||
|
||||
//**************************************************************************
|
||||
//**************************************************************************
|
||||
|
@ -63,7 +63,7 @@ Base::Quantity PropertyQuantity::getQuantityValue(void) const
|
|||
|
||||
const char* PropertyQuantity::getEditorName(void) const
|
||||
{
|
||||
return "Gui::PropertyEditor::PropertyUnitItem";
|
||||
return "Gui::PropertyEditor::PropertyUnitItem";
|
||||
}
|
||||
|
||||
PyObject *PropertyQuantity::getPyObject(void)
|
||||
|
@ -210,7 +210,7 @@ TYPESYSTEM_SOURCE(App::PropertyLength, App::PropertyQuantityConstraint);
|
|||
PropertyLength::PropertyLength()
|
||||
{
|
||||
setUnit(Base::Unit::Length);
|
||||
setConstraints( &LengthStandart );
|
||||
setConstraints(&LengthStandard);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -223,7 +223,7 @@ TYPESYSTEM_SOURCE(App::PropertyAngle, App::PropertyQuantityConstraint);
|
|||
PropertyAngle::PropertyAngle()
|
||||
{
|
||||
setUnit(Base::Unit::Angle);
|
||||
setConstraints( &AngleStandart );
|
||||
setConstraints(&AngleStandard);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
|
|
|
@ -160,17 +160,17 @@ void InputField::newInput(const QString & text)
|
|||
QPixmap pixmap = BitmapFactory().pixmapFromSvg(":/icons/button_invalid.svg", QSize(sizeHint().height(),sizeHint().height()));
|
||||
iconLabel->setPixmap(pixmap);
|
||||
parseError(QString::fromAscii(ErrorText.c_str()));
|
||||
validInput = false;
|
||||
validInput = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// check if unit fits!
|
||||
if(!actUnit.isEmpty() && !res.getUnit().isEmpty() && actUnit != res.getUnit()){
|
||||
this->setToolTip(QString::fromAscii("Wrong unit"));
|
||||
// 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"));
|
||||
validInput = false;
|
||||
validInput = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ void InputField::setUnit(const Base::Unit& unit)
|
|||
actUnit = unit;
|
||||
}
|
||||
|
||||
Base::Unit InputField::getUnit()
|
||||
const Base::Unit& InputField::getUnit() const
|
||||
{
|
||||
return actUnit;
|
||||
}
|
||||
|
|
|
@ -69,15 +69,15 @@ public:
|
|||
void setValue(const Base::Quantity&);
|
||||
//set a numerical value which gets converted to a quantity with the currently set unit type
|
||||
void setValue(const double&);
|
||||
|
||||
|
||||
/// get the current value
|
||||
Base::Quantity getQuantity(void)const{return this->actQuantity;}
|
||||
|
||||
|
||||
/// gives the current state of the user input, gives true if it is a valid input with correct quantity
|
||||
/// (shown by the green pixmap), returns false if the input is a unparsable string or has a wrong unit
|
||||
/// (shown by the red pixmap in the gui)
|
||||
bool hasValidInput() { return validInput;};
|
||||
|
||||
|
||||
/** sets the Unit this field is working with.
|
||||
* After setting the Unit the field will only accept
|
||||
* user input with this unit type. Or if the user input
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
* Quantity.
|
||||
*/
|
||||
void setUnit(const Base::Unit&);
|
||||
Base::Unit getUnit();
|
||||
const Base::Unit& getUnit() const;
|
||||
|
||||
/// set the input field to the last used value (works only if the setParamGrpPath() was called)
|
||||
void setToLastUsedValue(void);
|
||||
|
|
|
@ -82,7 +82,7 @@ Placement::Placement(QWidget* parent, Qt::WFlags fl)
|
|||
propertyName = "Placement"; // default name
|
||||
ui = new Ui_PlacementComp(this);
|
||||
ui->applyPlacementChange->hide();
|
||||
|
||||
|
||||
ui->xPos->setUnit(Base::Unit::Length);
|
||||
ui->yPos->setUnit(Base::Unit::Length);
|
||||
ui->zPos->setUnit(Base::Unit::Length);
|
||||
|
@ -137,7 +137,7 @@ bool Placement::hasValidInputs()
|
|||
QList<Gui::InputField*> sb = this->findChildren<Gui::InputField*>();
|
||||
for (QList<Gui::InputField*>::iterator it = sb.begin(); it != sb.end(); ++it) {
|
||||
if(!(*it)->hasValidInput())
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -298,14 +298,14 @@ void Placement::accept()
|
|||
void Placement::on_applyButton_clicked()
|
||||
{
|
||||
//only process things when we have valid inputs!
|
||||
if(!hasValidInputs()) {
|
||||
QMessageBox msg;
|
||||
msg.setIcon(QMessageBox::Critical);
|
||||
msg.setText(QString::fromAscii("There are input fields with incorrect input, please ensure valid placement values!"));
|
||||
msg.exec();
|
||||
return;
|
||||
if (!hasValidInputs()) {
|
||||
QMessageBox msg;
|
||||
msg.setIcon(QMessageBox::Critical);
|
||||
msg.setText(tr("There are input fields with incorrect input, please ensure valid placement values!"));
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If there are listeners to the 'placementChanged' signal we rely
|
||||
// on that the listener updates any placement. If no listeners
|
||||
// are connected the placement is applied to all selected objects
|
||||
|
|
|
@ -654,16 +654,16 @@ TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyUnitConstraintItem, Gui::Property
|
|||
|
||||
PropertyUnitConstraintItem::PropertyUnitConstraintItem()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PropertyUnitConstraintItem::setEditorData(QWidget *editor, const QVariant& data) const
|
||||
{
|
||||
const Base::Quantity& value = data.value<Base::Quantity>();
|
||||
|
||||
|
||||
Gui::InputField *infield = qobject_cast<Gui::InputField*>(editor);
|
||||
infield->setValue(value);
|
||||
|
||||
|
||||
const std::vector<App::Property*>& items = getPropertyData();
|
||||
App::PropertyQuantityConstraint* prop = (App::PropertyQuantityConstraint*)items[0];
|
||||
|
||||
|
@ -966,9 +966,9 @@ QVariant PropertyVectorDistanceItem::toString(const QVariant& prop) const
|
|||
{
|
||||
const Base::Vector3d& value = prop.value<Base::Vector3d>();
|
||||
QString data = QString::fromAscii("[") +
|
||||
Base::Quantity(value.x, Base::Unit::Length).getUserString() + QString::fromAscii(" ") +
|
||||
Base::Quantity(value.y, Base::Unit::Length).getUserString() + QString::fromAscii(" ") +
|
||||
Base::Quantity(value.z, Base::Unit::Length).getUserString() + QString::fromAscii("]");
|
||||
Base::Quantity(value.x, Base::Unit::Length).getUserString() + QString::fromAscii(" ") +
|
||||
Base::Quantity(value.y, Base::Unit::Length).getUserString() + QString::fromAscii(" ") +
|
||||
Base::Quantity(value.z, Base::Unit::Length).getUserString() + QString::fromAscii("]");
|
||||
return QVariant(data);
|
||||
}
|
||||
|
||||
|
@ -986,14 +986,14 @@ void PropertyVectorDistanceItem::setValue(const QVariant& variant)
|
|||
if (!variant.canConvert<Base::Vector3d>())
|
||||
return;
|
||||
const Base::Vector3d& value = variant.value<Base::Vector3d>();
|
||||
|
||||
|
||||
Base::Quantity q = Base::Quantity(value.x, Base::Unit::Length);
|
||||
QString unit = QString::fromLatin1("('%1 %2'").arg(q.getValue()).arg(q.getUnit().getString());
|
||||
q = Base::Quantity(value.y, Base::Unit::Length);
|
||||
unit + QString::fromLatin1("'%1 %2'").arg(q.getValue()).arg(q.getUnit().getString());
|
||||
q = Base::Quantity(value.z, Base::Unit::Length);
|
||||
QString::fromLatin1("'%1 %2')").arg(q.getValue()).arg(q.getUnit().getString());
|
||||
|
||||
|
||||
setPropertyValue(unit);
|
||||
}
|
||||
|
||||
|
|
|
@ -373,13 +373,12 @@ class GuiExport PropertyVectorDistanceItem: public PropertyItem
|
|||
void setY(Base::Quantity y);
|
||||
Base::Quantity z() const;
|
||||
void setZ(Base::Quantity z);
|
||||
|
||||
|
||||
protected:
|
||||
virtual QVariant toString(const QVariant&) const;
|
||||
virtual QVariant value(const App::Property*) const;
|
||||
virtual void setValue(const QVariant&);
|
||||
|
||||
|
||||
PropertyVectorDistanceItem();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue
Block a user