Added new property type: App::PropertyVectorDistance
This works exactly as a normal PropertyVector, but it uses the Units-enabled GUI editor instead.
This commit is contained in:
parent
1ed0ec974a
commit
e19e7336cd
|
@ -1073,6 +1073,7 @@ void Application::initTypes(void)
|
|||
App ::PropertyLinkSubList ::init();
|
||||
App ::PropertyMatrix ::init();
|
||||
App ::PropertyVector ::init();
|
||||
App ::PropertyVectorDistance ::init();
|
||||
App ::PropertyVectorList ::init();
|
||||
App ::PropertyPlacement ::init();
|
||||
App ::PropertyPlacementLink ::init();
|
||||
|
|
|
@ -175,6 +175,27 @@ void PropertyVector::Paste(const Property &from)
|
|||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// PropertyVectorDistance
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
TYPESYSTEM_SOURCE(App::PropertyVectorDistance , App::PropertyVector);
|
||||
|
||||
//**************************************************************************
|
||||
// Construction/Destruction
|
||||
|
||||
|
||||
PropertyVectorDistance::PropertyVectorDistance()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PropertyVectorDistance::~PropertyVectorDistance()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// PropertyVectorList
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
|
|
@ -100,6 +100,44 @@ private:
|
|||
};
|
||||
|
||||
|
||||
class AppExport PropertyVectorDistance: public PropertyVector
|
||||
{
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
/**
|
||||
* A constructor.
|
||||
* A more elaborate description of the constructor.
|
||||
*/
|
||||
PropertyVectorDistance();
|
||||
|
||||
/**
|
||||
* A destructor.
|
||||
* A more elaborate description of the destructor.
|
||||
*/
|
||||
virtual ~PropertyVectorDistance();
|
||||
|
||||
/** Sets the property
|
||||
*/
|
||||
void setValue(const Base::Vector3d &vec);
|
||||
void setValue(double x, double y, double z);
|
||||
|
||||
/** This method returns a string representation of the property
|
||||
*/
|
||||
const Base::Vector3d &getValue(void) const;
|
||||
const char* getEditorName(void) const {
|
||||
return "Gui::PropertyEditor::PropertyVectorDistanceItem";
|
||||
}
|
||||
|
||||
virtual unsigned int getMemSize (void) const {
|
||||
return sizeof(Base::Vector3d);
|
||||
}
|
||||
|
||||
private:
|
||||
Base::Vector3d _cVec;
|
||||
};
|
||||
|
||||
|
||||
class AppExport PropertyVectorList: public PropertyLists
|
||||
{
|
||||
TYPESYSTEM_HEADER();
|
||||
|
|
|
@ -1011,9 +1011,9 @@ void PropertyVectorDistanceItem::setValue(const QVariant& variant)
|
|||
Base::Quantity y = Base::Quantity(value.y, Base::Unit::Length);
|
||||
Base::Quantity z = Base::Quantity(value.z, Base::Unit::Length);
|
||||
QString data = QString::fromAscii("(%1, %2, %3)")
|
||||
.arg(x.getUserString())
|
||||
.arg(y.getUserString())
|
||||
.arg(z.getUserString());
|
||||
.arg(x.getValue())
|
||||
.arg(y.getValue())
|
||||
.arg(z.getValue());
|
||||
setPropertyValue(data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user