Fix overlap of dimension selection area

This commit is contained in:
wandererfan
2019-06-07 20:13:57 -04:00
committed by WandererFan
parent 5deca3b667
commit 4816755f42
5 changed files with 187 additions and 95 deletions

View File

@@ -32,6 +32,10 @@
#include <QPainter>
#endif
#include <App/Application.h>
#include <Base/Parameter.h>
#include <Base/Console.h>
#include "QGIDimLines.h"
using namespace TechDrawGui;
@@ -50,19 +54,36 @@ void QGIDimLines::draw()
{
}
QRectF QGIDimLines::boundingRect() const
QPainterPath QGIDimLines::shape() const
{
return shape().boundingRect().adjusted(-2, -2, 2, 2); //room for 0.5 line widths? needs Rez::guiX??
// return childrenBoundingRect().adjusted(-2,-2,2,2);
QPainterPath outline;
QPainterPathStroker stroker;
stroker.setWidth(getEdgeFuzz());
outline = stroker.createStroke(path());
return outline;
}
double QGIDimLines::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 QGIDimLines::boundingRect() const
{
return shape().controlPointRect().adjusted(-3, -3, 3, 3);
}
//probably don't need this paint
void QGIDimLines::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QStyleOptionGraphicsItem myOption(*option);
myOption.state &= ~QStyle::State_Selected;
// painter->drawRect(boundingRect()); //good for debugging
// painter->drawRect(boundingRect()); //good for debugging
// painter->drawPath(shape()); //good for debugging
QGIPrimPath::paint (painter, &myOption, widget);
}