Make Edge Selection Area Adjustable

- Edges may be difficult to select depending on drawing
  scale and zoom level.
- Parameter: Preferences/Mod/TechDraw/General/EdgeFuzz
This commit is contained in:
wandererfan
2018-12-01 08:34:49 -05:00
committed by Yorik van Havre
parent ac15cda1d4
commit 7b4bc50e5c
2 changed files with 14 additions and 1 deletions

View File

@@ -93,6 +93,15 @@ Qt::PenStyle QGIEdge::getHiddenStyle()
return hidStyle;
}
double QGIEdge::getEdgeFuzz(void) const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
double result = hGrp->GetFloat("EdgeFuzz",10.0);
return result;
}
QRectF QGIEdge::boundingRect() const
{
return shape().controlPointRect();
@@ -102,7 +111,7 @@ QPainterPath QGIEdge::shape() const
{
QPainterPath outline;
QPainterPathStroker stroker;
stroker.setWidth(2.0);
stroker.setWidth(getEdgeFuzz());
outline = stroker.createStroke(path());
return outline;
}
@@ -111,5 +120,7 @@ void QGIEdge::paint ( QPainter * painter, const QStyleOptionGraphicsItem * optio
QStyleOptionGraphicsItem myOption(*option);
myOption.state &= ~QStyle::State_Selected;
//~ painter->drawRect(boundingRect()); //good for debugging
QGIPrimPath::paint (painter, &myOption, widget);
}

View File

@@ -49,6 +49,8 @@ public:
void setSmoothEdge(bool b) { isSmoothEdge = b; }
bool getSmoothEdge() { return(isSmoothEdge); }
virtual void setPrettyNormal() override;
double getEdgeFuzz(void) const;
protected:
int projIndex; //index of edge in Projection. must exist.