[TD] disable the frame parameters if there is no frame

see https://forum.freecadweb.org/viewtopic.php?f=35&t=42747&start=10#p363768 following
This commit is contained in:
donovaly
2020-01-28 02:38:20 +01:00
committed by WandererFan
parent 853dc6d884
commit e148a08b0e
2 changed files with 15 additions and 2 deletions

View File

@@ -74,7 +74,7 @@ ViewProviderLeader::ViewProviderLeader()
static const char *group = "Line Format";
ADD_PROPERTY_TYPE(LineWidth,(getDefLineWeight()),group,(App::PropertyType)(App::Prop_None),"Line width");
ADD_PROPERTY_TYPE(LineStyle,(1),group,(App::PropertyType)(App::Prop_None),"Line style");
ADD_PROPERTY_TYPE(LineStyle,(1),group,(App::PropertyType)(App::Prop_None),"Line style index");
ADD_PROPERTY_TYPE(Color,(getDefLineColor()),group,App::Prop_None,"The color of the Markup");
LineStyle.setConstraints(&LineStyleRange);

View File

@@ -72,7 +72,7 @@ ViewProviderRichAnno::ViewProviderRichAnno()
static const char *group = "Frame Format";
ADD_PROPERTY_TYPE(LineWidth,(getDefLineWeight()), group,(App::PropertyType)(App::Prop_None),"Frame line width");
ADD_PROPERTY_TYPE(LineStyle,(1),group,(App::PropertyType)(App::Prop_None),"Frame line style");
ADD_PROPERTY_TYPE(LineStyle,(1),group,(App::PropertyType)(App::Prop_None),"Frame line style index");
ADD_PROPERTY_TYPE(LineColor,(getDefLineColor()),group,App::Prop_None,"The color of the frame");
LineStyle.setConstraints(&LineStyleRange);
@@ -124,6 +124,19 @@ bool ViewProviderRichAnno::doubleClicked(void)
void ViewProviderRichAnno::updateData(const App::Property* p)
{
// only if there is a frame we can enable the frame line parameters
if (getViewObject() != nullptr) {
if (getViewObject()->ShowFrame.getValue()) {
LineWidth.setStatus(App::Property::ReadOnly, false);
LineStyle.setStatus(App::Property::ReadOnly, false);
LineColor.setStatus(App::Property::ReadOnly, false);
}
else {
LineWidth.setStatus(App::Property::ReadOnly, true);
LineStyle.setStatus(App::Property::ReadOnly, true);
LineColor.setStatus(App::Property::ReadOnly, true);
}
}
ViewProviderDrawingView::updateData(p);
}