25 #include <QStringList>
27 #include "../../vproperty_p.h"
28 #include "../vnumberproperty.h"
33 QVariant tmpFloat(0); tmpFloat.convert(QVariant::Double);
44 if (column == DPC_Data && Qt::DisplayRole == role)
47 return QString(
"(%1, %2, %3)").arg(QString::number(tmpVect.
X),
48 QString::number(tmpVect.
Y),
49 QString::number(tmpVect.
Z));
58 if (column == DPC_Name || column == DPC_Data)
60 return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
63 return Qt::NoItemFlags;
72 if (d_ptr->Children.count() < 3)
77 tmpVect.
X = d_ptr->Children.at(0)->getValue().toDouble();
78 tmpVect.
Y = d_ptr->Children.at(1)->getValue().toDouble();
79 tmpVect.
Z = d_ptr->Children.at(2)->getValue().toDouble();
87 setVector(vect.
X, vect.
Y, vect.
Z);
92 if (d_ptr->Children.count() < 3)
97 QVariant tmpX(x); tmpX.convert(QVariant::Double);
98 QVariant tmpY(y); tmpY.convert(QVariant::Double);
99 QVariant tmpZ(z); tmpZ.convert(QVariant::Double);
100 d_ptr->Children.at(0)->setValue(tmpX);
101 d_ptr->Children.at(1)->setValue(tmpY);
102 d_ptr->Children.at(2)->setValue(tmpZ);
116 if (!include_children)
119 foreach (
VProperty* tmpChild, tmpChildren)
132 QStringList tmpStrings = value.toString().split(
",");
133 if (tmpStrings.count() == 3)
135 setVector(tmpStrings[0].toDouble(), tmpStrings[1].toDouble(), tmpStrings[2].toDouble());
143 return QString(
"%1,%2,%3").arg(QString::number(tmpVect.
X), QString::number(tmpVect.
Y), QString::number(tmpVect.
Z));
Class for holding a double property.
virtual Vector3D getVector() const
Returns the Vector3d.
virtual Qt::ItemFlags flags(int column=DPC_Name) const Q_DECL_OVERRIDE
Returns item flags.
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
virtual QVariant getValue() const Q_DECL_OVERRIDE
Returns the value of the property as a QVariant.
virtual void setVector(const Vector3D &vect)
Sets the Vector3d.
QVector3DProperty(const QString &name)
virtual VProperty * clone(bool include_children=true, VProperty *container=NULL) const Q_DECL_OVERRIDE
Clones this property.
virtual QString type() const Q_DECL_OVERRIDE
Returns a string containing the type of the property.
virtual QVariant data(int column=DPC_Name, int role=Qt::DisplayRole) const Q_DECL_OVERRIDE
Get the data how it should be displayed.
virtual Q_REQUIRED_RESULT VProperty * clone(bool include_children=true, VProperty *container=nullptr) const
Clones this property.
virtual void setUpdateBehaviour(bool update_parent, bool update_children)
Sets whether the views should update Parents or children after this property changes.
virtual QVariant data(int column=DPC_Name, int role=Qt::DisplayRole) const
Get the data how it should be displayed.
virtual void removeChild(VProperty *child)
Removes a child from the children list, doesn't delete the child!
virtual int addChild(VProperty *child)
Adds a child to this property.
virtual QList< VProperty * > & getChildren()
Returns a reference to the list of children.