+ do not allow to set negative grid size in property editor

This commit is contained in:
wmayer 2016-03-01 18:24:39 +01:00
parent 0c5a477fee
commit a1eef54451
2 changed files with 6 additions and 2 deletions

View File

@ -32,6 +32,7 @@
# include <Inventor/nodes/SoPickStyle.h>
# include <Inventor/nodes/SoSeparator.h>
# include <Inventor/nodes/SoVertexProperty.h>
# include <cfloat>
#endif
/// Here the FreeCAD includes sorted by Base,App,Gui......
@ -52,6 +53,7 @@ using namespace std;
// Construction/Destruction
const char* ViewProvider2DObject::GridStyleEnums[]= {"Dashed","Light",NULL};
App::PropertyQuantityConstraint::Constraints ViewProvider2DObject::GridSizeRange = {0.001,DBL_MAX,1.0};
PROPERTY_SOURCE(PartGui::ViewProvider2DObject, PartGui::ViewProviderPart)
@ -68,9 +70,10 @@ ViewProvider2DObject::ViewProvider2DObject()
MinX = MinY = -100;
MaxX = MaxY = 100;
GridStyle.setEnums(GridStyleEnums);
GridSize.setConstraints(&GridSizeRange);
pcRoot->addChild(GridRoot);
sPixmap = "PartFeatureImport";
}

View File

@ -49,7 +49,7 @@ public:
/// Property to switch the grid on and off
App::PropertyBool ShowGrid;
App::PropertyDistance GridSize;
App::PropertyLength GridSize;
App::PropertyEnumeration GridStyle;
App::PropertyBool TightGrid;
App::PropertyBool GridSnap;
@ -75,6 +75,7 @@ protected:
float MinY;
float MaxY;
static const char* GridStyleEnums[];
static App::PropertyQuantityConstraint::Constraints GridSizeRange;
};
typedef Gui::ViewProviderPythonFeatureT<ViewProvider2DObject> ViewProvider2DObjectPython;