Add LineWidth property for Dimension lines

This commit is contained in:
WandererFan 2016-07-27 20:27:20 -04:00 committed by Yorik van Havre
parent e95d527267
commit 3588479ff5
3 changed files with 10 additions and 6 deletions

View File

@ -94,6 +94,7 @@ DrawViewDimension::DrawViewDimension(void)
ADD_PROPERTY_TYPE(Fontsize,(4) ,"Format",(App::PropertyType)(App::Prop_None),"Dimension text size in mm");
ADD_PROPERTY_TYPE(CentreLines,(0) ,"Format",(App::PropertyType)(App::Prop_None),"Arc Dimension Center Mark");
ADD_PROPERTY_TYPE(FormatSpec,("%value%") ,"Format",(App::PropertyType)(App::Prop_None),"Dimension Format");
ADD_PROPERTY_TYPE(LineWidth,(0.5) ,"Format",(App::PropertyType)(App::Prop_None),"Dimension line weight");
Type.setEnums(TypeEnums); //dimension type: length, radius etc
ADD_PROPERTY(Type,((long)0));
@ -129,7 +130,8 @@ void DrawViewDimension::onChanged(const App::Property* prop)
prop == &Font ||
prop == &Fontsize ||
prop == &CentreLines ||
prop == &FormatSpec) {
prop == &FormatSpec ||
prop == &LineWidth) {
try {
App::DocumentObjectExecReturn *ret = recompute();
delete ret;

View File

@ -56,6 +56,7 @@ public:
App::PropertyFloat Fontsize;
App::PropertyBool CentreLines;
App::PropertyString FormatSpec;
App::PropertyFloat LineWidth;
//TODO: do we need a property for the actual dimension value? how else to access from Py?
//wf: expose getValue & getFormatedValue

View File

@ -183,14 +183,13 @@ QGIViewDimension::QGIViewDimension() :
dlabel, SIGNAL(hover(bool)),
this , SLOT (hover(bool)));
m_pen.setWidthF(0.5);
m_clPen.setWidthF(m_pen.widthF() * 0.80);
m_clPen.setColor(QColor(128,128,128)); // TODO: centre line colour preference?
addToGroup(dimLines);
addToGroup(datumLabel);
addToGroup(centerMark);
m_pen.setStyle(Qt::SolidLine);
m_clPen.setColor(QColor(128,128,128)); // TODO: centre line colour preference?
toggleBorder(false);
}
@ -313,7 +312,9 @@ void QGIViewDimension::draw()
if(!refObj->hasGeometry()) { //nothing to draw yet (restoring)
return;
}
m_pen.setStyle(Qt::SolidLine);
m_pen.setWidthF(dim->LineWidth.getValue());
m_clPen.setWidthF(m_pen.widthF() * 0.80); //magic number!!!!
// Crude method of determining state [TODO] improve
if(isSelected()) {