Skip to content

Commit

Permalink
Add LineWidth property for Dimension lines
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan authored and yorikvanhavre committed Aug 1, 2016
1 parent e95d527 commit 3588479
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/Mod/TechDraw/App/DrawViewDimension.cpp
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/Mod/TechDraw/App/DrawViewDimension.h
Expand Up @@ -56,6 +56,7 @@ class TechDrawExport DrawViewDimension : public TechDraw::DrawView
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
Expand Down
11 changes: 6 additions & 5 deletions src/Mod/TechDraw/Gui/QGIViewDimension.cpp
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit 3588479

Please sign in to comment.