diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index d8c3d627d..091c10512 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -48,6 +48,16 @@ public: bool operator () (const std::pair& elem) const { if (elem.first == propertyname) { + // flag set that property is read-only or hidden + if (elem.second->StatusBits.test(2) || elem.second->StatusBits.test(3)) + return false; + App::PropertyContainer* parent = elem.second->getContainer(); + if (parent) { + // flag set that property is read-only or hidden + if (parent->isReadOnly(elem.second) || + parent->isHidden(elem.second)) + return false; + } return elem.second->isDerivedFrom (Base::Type::fromName("App::PropertyPlacement")); } diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 4c7966741..3f0e5b08f 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -121,6 +121,8 @@ int PropertyItem::columnCount() const void PropertyItem::setReadOnly(bool ro) { readonly = ro; + for (QList::iterator it = childItems.begin(); it != childItems.end(); ++it) + (*it)->setReadOnly(ro); } bool PropertyItem::isReadOnly() const diff --git a/src/Mod/PartDesign/App/FeatureDressUp.cpp b/src/Mod/PartDesign/App/FeatureDressUp.cpp index 0fb3bb606..da69c80ed 100644 --- a/src/Mod/PartDesign/App/FeatureDressUp.cpp +++ b/src/Mod/PartDesign/App/FeatureDressUp.cpp @@ -48,4 +48,14 @@ void DressUp::positionByBase(void) this->Placement.setValue(base->Placement.getValue()); } +void DressUp::onChanged(const App::Property* prop) +{ + if (prop == &Base) { + // if attached to a sketch then mark it as read-only + this->Placement.StatusBits.set(2, Base.getValue() != 0); + } + + Feature::onChanged(prop); +} + } diff --git a/src/Mod/PartDesign/App/FeatureDressUp.h b/src/Mod/PartDesign/App/FeatureDressUp.h index f72fc4624..e439172f2 100644 --- a/src/Mod/PartDesign/App/FeatureDressUp.h +++ b/src/Mod/PartDesign/App/FeatureDressUp.h @@ -41,7 +41,10 @@ public: /// updates the Placement property from the Placement of Base void positionByBase(void); - }; + +protected: + void onChanged(const App::Property* prop); +}; } //namespace PartDesign diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index 286e51815..ce6323632 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -89,6 +89,16 @@ void SketchBased::positionBySketch(void) } } +void SketchBased::onChanged(const App::Property* prop) +{ + if (prop == &Sketch) { + // if attached to a sketch then mark it as read-only + this->Placement.StatusBits.set(2, Sketch.getValue() != 0); + } + + Feature::onChanged(prop); +} + bool SketchBased::isInside(const TopoDS_Wire& wire1, const TopoDS_Wire& wire2) const { Bnd_Box box1; diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.h b/src/Mod/PartDesign/App/FeatureSketchBased.h index 1255f6f7b..8fab20939 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.h +++ b/src/Mod/PartDesign/App/FeatureSketchBased.h @@ -51,6 +51,7 @@ public: int getSketchAxisCount(void) const; protected: + void onChanged(const App::Property* prop); TopoDS_Face validateFace(const TopoDS_Face&) const; TopoDS_Shape makeFace(const std::vector&) const; TopoDS_Shape makeFace(std::list&) const; // for internal use only