More suggestions for float->double move from Gui subdirectory
This commit is contained in:
parent
c3bd10430b
commit
bcdc353375
|
@ -189,7 +189,7 @@ void DlgDisplayPropertiesImp::slotChangedObject(const Gui::ViewProvider& obj,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (prop.getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
else if (prop.getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||||
float value = static_cast<const App::PropertyFloat&>(prop).getValue();
|
double value = static_cast<const App::PropertyFloat&>(prop).getValue();
|
||||||
if (prop_name == "PointSize") {
|
if (prop_name == "PointSize") {
|
||||||
bool blocked = spinPointSize->blockSignals(true);
|
bool blocked = spinPointSize->blockSignals(true);
|
||||||
spinPointSize->setValue((int)value);
|
spinPointSize->setValue((int)value);
|
||||||
|
@ -325,7 +325,7 @@ void DlgDisplayPropertiesImp::on_spinPointSize_valueChanged(int pointsize)
|
||||||
App::Property* prop = (*It)->getPropertyByName("PointSize");
|
App::Property* prop = (*It)->getPropertyByName("PointSize");
|
||||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||||
App::PropertyFloat* PointSize = (App::PropertyFloat*)prop;
|
App::PropertyFloat* PointSize = (App::PropertyFloat*)prop;
|
||||||
PointSize->setValue((float)pointsize);
|
PointSize->setValue((double)pointsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ void DlgDisplayPropertiesImp::on_spinLineWidth_valueChanged(int linewidth)
|
||||||
App::Property* prop = (*It)->getPropertyByName("LineWidth");
|
App::Property* prop = (*It)->getPropertyByName("LineWidth");
|
||||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||||
App::PropertyFloat* LineWidth = (App::PropertyFloat*)prop;
|
App::PropertyFloat* LineWidth = (App::PropertyFloat*)prop;
|
||||||
LineWidth->setValue((float)linewidth);
|
LineWidth->setValue((double)linewidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -882,7 +882,7 @@ QVariant PropertyVectorItem::value(const App::Property* prop) const
|
||||||
|
|
||||||
void PropertyVectorItem::setValue(const QVariant& value)
|
void PropertyVectorItem::setValue(const QVariant& value)
|
||||||
{
|
{
|
||||||
if (!value.canConvert<Base::Vector3f>())
|
if (!value.canConvert<Base::Vector3d>())
|
||||||
return;
|
return;
|
||||||
const Base::Vector3d& val = value.value<Base::Vector3d>();
|
const Base::Vector3d& val = value.value<Base::Vector3d>();
|
||||||
QString data = QString::fromAscii("(%1, %2, %3)")
|
QString data = QString::fromAscii("(%1, %2, %3)")
|
||||||
|
@ -919,32 +919,32 @@ QVariant PropertyVectorItem::editorData(QWidget *editor) const
|
||||||
|
|
||||||
double PropertyVectorItem::x() const
|
double PropertyVectorItem::x() const
|
||||||
{
|
{
|
||||||
return data(1,Qt::EditRole).value<Base::Vector3f>().x;
|
return data(1,Qt::EditRole).value<Base::Vector3d>().x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyVectorItem::setX(double x)
|
void PropertyVectorItem::setX(double x)
|
||||||
{
|
{
|
||||||
setData(QVariant::fromValue(Base::Vector3f(x, y(), z())));
|
setData(QVariant::fromValue(Base::Vector3d(x, y(), z())));
|
||||||
}
|
}
|
||||||
|
|
||||||
double PropertyVectorItem::y() const
|
double PropertyVectorItem::y() const
|
||||||
{
|
{
|
||||||
return data(1,Qt::EditRole).value<Base::Vector3f>().y;
|
return data(1,Qt::EditRole).value<Base::Vector3d>().y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyVectorItem::setY(double y)
|
void PropertyVectorItem::setY(double y)
|
||||||
{
|
{
|
||||||
setData(QVariant::fromValue(Base::Vector3f(x(), y, z())));
|
setData(QVariant::fromValue(Base::Vector3d(x(), y, z())));
|
||||||
}
|
}
|
||||||
|
|
||||||
double PropertyVectorItem::z() const
|
double PropertyVectorItem::z() const
|
||||||
{
|
{
|
||||||
return data(1,Qt::EditRole).value<Base::Vector3f>().z;
|
return data(1,Qt::EditRole).value<Base::Vector3d>().z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyVectorItem::setZ(double z)
|
void PropertyVectorItem::setZ(double z)
|
||||||
{
|
{
|
||||||
setData(QVariant::fromValue(Base::Vector3f(x(), y(), z)));
|
setData(QVariant::fromValue(Base::Vector3d(x(), y(), z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
|
@ -83,6 +83,7 @@ bool PropertyModel::setData(const QModelIndex& index, const QVariant & value, in
|
||||||
if (data.type() == QVariant::Double && value.type() == QVariant::Double) {
|
if (data.type() == QVariant::Double && value.type() == QVariant::Double) {
|
||||||
// since we store some properties as floats we get some round-off
|
// since we store some properties as floats we get some round-off
|
||||||
// errors here. Thus, we use an epsilon here.
|
// errors here. Thus, we use an epsilon here.
|
||||||
|
// NOTE: Since 0.14 PropertyFloat uses double precision, so this is maybe unnecessary now?
|
||||||
double d = data.toDouble();
|
double d = data.toDouble();
|
||||||
double v = value.toDouble();
|
double v = value.toDouble();
|
||||||
if (fabs(d-v) > FLT_EPSILON)
|
if (fabs(d-v) > FLT_EPSILON)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user