start PropertyQuantity and InputField

This commit is contained in:
jriegel
2013-09-22 21:23:25 +02:00
parent 3ee7b20927
commit 4732a800e9
9 changed files with 203 additions and 0 deletions

View File

@@ -94,6 +94,8 @@ FeatureTest::FeatureTest()
ADD_PROPERTY_TYPE(TypeAll ,(4711),group,(App::PropertyType) (Prop_Output|Prop_ReadOnly |Prop_Hidden ),
"An example property which has the types 'Output', 'ReadOnly' and 'Hidden'");
ADD_PROPERTY(Quantity,(1.0));
}
FeatureTest::~FeatureTest()

View File

@@ -93,6 +93,8 @@ public:
App::PropertyInteger TypeAll;
App::PropertyInteger TypeTransient;
App::PropertyQuantity Quantity;
/** @name methods overide Feature */
//@{
/// recalculate the Feature

View File

@@ -38,6 +38,7 @@
#include "PropertyUnits.h"
#include <Base/PyObjectBase.h>
#include <Base/QuantityPy.h>
#define new DEBUG_CLIENTBLOCK
using namespace App;
@@ -47,6 +48,29 @@ using namespace std;
//**************************************************************************
//**************************************************************************
// PropertyFloatUnit
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TYPESYSTEM_SOURCE(App::PropertyQuantity, App::PropertyFloat);
const char* PropertyQuantity::getEditorName(void) const
{
return "Gui::PropertyEditor::PropertyUnitItem";
}
PyObject *PropertyQuantity::getPyObject(void)
{
return new QuantityPy (new Quantity( _dValue,_Unit));
}
void PropertyQuantity::setPyObject(PyObject *value)
{
setValue(UnitsApi::toDblWithUserPrefs(Length,value));
}
//**************************************************************************
//**************************************************************************

View File

@@ -32,6 +32,7 @@
#include <vector>
#include <boost/filesystem/path.hpp>
#include <Base/Unit.h>
#include "PropertyStandard.h"
namespace Base {
@@ -42,6 +43,25 @@ class Writer;
namespace App
{
/** Float with Unit property
* This is a property for float with a predefined Unit associated .
*/
class AppExport PropertyQuantity : public PropertyFloat
{
TYPESYSTEM_HEADER();
public:
PropertyQuantity(void){}
virtual ~PropertyQuantity(){}
virtual const char* getEditorName(void) const;
virtual PyObject *getPyObject(void);
virtual void setPyObject(PyObject *);
void setUnit(const Base::Unit &u){_Unit = u;}
const Base::Unit &getUnit(void)const{return _Unit;}
protected:
Base::Unit _Unit;
};
/** Distance property
* This is a property for representing distances. It is basically a float