diff --git a/src/App/FeatureTest.cpp b/src/App/FeatureTest.cpp
index de18f1bf7..d5e2be160 100644
--- a/src/App/FeatureTest.cpp
+++ b/src/App/FeatureTest.cpp
@@ -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()
diff --git a/src/App/FeatureTest.h b/src/App/FeatureTest.h
index fc2908574..71dbc9dc7 100644
--- a/src/App/FeatureTest.h
+++ b/src/App/FeatureTest.h
@@ -93,6 +93,8 @@ public:
App::PropertyInteger TypeAll;
App::PropertyInteger TypeTransient;
+ App::PropertyQuantity Quantity;
+
/** @name methods overide Feature */
//@{
/// recalculate the Feature
diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp
index e20f3e698..99dda7797 100644
--- a/src/App/PropertyUnits.cpp
+++ b/src/App/PropertyUnits.cpp
@@ -38,6 +38,7 @@
#include "PropertyUnits.h"
#include
+#include
#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));
+}
//**************************************************************************
//**************************************************************************
diff --git a/src/App/PropertyUnits.h b/src/App/PropertyUnits.h
index a8ead9800..321e91d96 100644
--- a/src/App/PropertyUnits.h
+++ b/src/App/PropertyUnits.h
@@ -32,6 +32,7 @@
#include
#include
+#include
#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
diff --git a/src/Base/Quantity.cpp b/src/Base/Quantity.cpp
index 1c80c56b4..daec1d82e 100644
--- a/src/Base/Quantity.cpp
+++ b/src/Base/Quantity.cpp
@@ -28,6 +28,15 @@
#include "Quantity.h"
#include "Exception.h"
+// suppress annoying warnings from generated source files
+#ifdef _MSC_VER
+# pragma warning(disable : 4003)
+# pragma warning(disable : 4018)
+# pragma warning(disable : 4065)
+# pragma warning( disable : 4273 )
+# pragma warning(disable : 4335) // disable MAC file format warning on VC
+#endif
+
using namespace Base;
Quantity::Quantity()
diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt
index 8ecf08ac0..b9f19393f 100644
--- a/src/Gui/CMakeLists.txt
+++ b/src/Gui/CMakeLists.txt
@@ -173,6 +173,7 @@ set(Gui_MOC_HDRS
NetworkRetriever.h
OnlineDocumentation.h
Placement.h
+ InputField.h
PrefWidgets.h
ProgressBar.h
PropertyPage.h
@@ -738,6 +739,7 @@ SET(Widget_CPP_SRCS
MainWindow.cpp
MDIView.cpp
PrefWidgets.cpp
+ InputField.cpp
ProgressBar.cpp
SpinBox.cpp
Splashscreen.cpp
@@ -750,6 +752,7 @@ SET(Widget_HPP_SRCS
MainWindow.h
MDIView.h
PrefWidgets.h
+ InputField.h
ProgressBar.h
SpinBox.h
Splashscreen.h
diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp
new file mode 100644
index 000000000..91e305fa8
--- /dev/null
+++ b/src/Gui/InputField.cpp
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * Copyright (c) 2013 Juergen Riegel *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+
+#include "PreCompiled.h"
+
+#include
+
+#include "InputField.h"
+using namespace Gui;
+
+// --------------------------------------------------------------------
+
+InputField::InputField ( QWidget * parent )
+ : QLineEdit(parent)
+{
+}
+
+InputField::~InputField()
+{
+}
+
+
+
+/** Sets the preference path to \a path. */
+void InputField::setParamGrpPath( const QByteArray& path )
+{
+//#ifdef FC_DEBUG
+// if (getWindowParameter().isValid())
+// {
+// if ( paramGrpPath() != path )
+// Base::Console().Warning("Widget already attached\n");
+// }
+//#endif
+//
+// if ( paramGrpPath() != path )
+// {
+// if ( setGroupName( path ) )
+// {
+// m_sPrefGrp = path;
+// assert(getWindowParameter().isValid());
+// getWindowParameter()->Attach(this);
+// }
+// }
+}
+
+/** Returns the widget's preferences path. */
+QByteArray InputField::paramGrpPath() const
+{
+ return m_sPrefGrp;
+}
+
+
+// --------------------------------------------------------------------
+
+
+#include "moc_InputField.cpp"
diff --git a/src/Gui/InputField.h b/src/Gui/InputField.h
new file mode 100644
index 000000000..0e7ee8a4d
--- /dev/null
+++ b/src/Gui/InputField.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (c) 2013 Juergen Riegel *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+
+#ifndef GUI_INPUTFIELD_H
+#define GUI_INPUTFIELD_H
+
+#include
+#include "Widgets.h"
+#include "Window.h"
+#include "SpinBox.h"
+#include "FileDialog.h"
+
+namespace Gui {
+
+
+/**
+ * The InputField class.
+ * \author Jürgen Riegel
+ */
+class GuiExport InputField : public QLineEdit
+{
+ Q_OBJECT
+
+ Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
+
+public:
+ InputField ( QWidget * parent = 0 );
+ virtual ~InputField();
+
+ // PROPERTIES
+ // getters
+ QByteArray paramGrpPath () const;
+ // setters
+ void setParamGrpPath ( const QByteArray& name );
+
+private:
+ QByteArray m_sPrefGrp;
+
+};
+
+
+
+} // namespace Gui
+
+#endif // GUI_INPUTFIELD_H
diff --git a/src/Gui/resource.cpp b/src/Gui/resource.cpp
index 8a72ca046..4a2676634 100644
--- a/src/Gui/resource.cpp
+++ b/src/Gui/resource.cpp
@@ -46,6 +46,7 @@
#include "DlgKeyboardImp.h"
#include "DlgCustomizeSpaceball.h"
#include "DlgCustomizeSpNavSettings.h"
+#include "InputField.h"
using namespace Gui;
using namespace Gui::Dialog;
@@ -82,6 +83,7 @@ WidgetFactorySupplier::WidgetFactorySupplier()
// ADD YOUR PREFERENCE WIDGETS HERE
//
//
+ new WidgetProducer;
new WidgetProducer;
new WidgetProducer;
new WidgetProducer;