[TD]Fix Arrowhead Fill in Dims & Leaders

This commit is contained in:
wandererfan
2019-09-29 16:32:52 -04:00
committed by WandererFan
parent b06a1470be
commit 1737d7e589
2 changed files with 25 additions and 18 deletions

View File

@@ -49,7 +49,7 @@ QGIArrow::QGIArrow() :
m_dir(Base::Vector3d(1.0,0.0,0.0))
{
setFlipped(false);
setFill(Qt::SolidPattern);
setFillStyle(Qt::SolidPattern);
m_brush.setStyle(m_fill);
m_colDefFill = getNormalColor();
m_colNormalFill = m_colDefFill;
@@ -63,33 +63,33 @@ QGIArrow::QGIArrow() :
void QGIArrow::draw() {
QPainterPath path;
if (m_style == 0) {
setFill(Qt::SolidPattern);
setFillStyle(Qt::SolidPattern);
if (m_dirMode) {
path = makeFilledTriangle(getDirection(), m_size,m_size/6.0);
} else {
path = makeFilledTriangle(m_size,m_size/6.0,isFlipped()); //"arrow l/w sb 3/1" ??
}
} else if (m_style == 1) {
setFill(Qt::NoBrush);
setFillStyle(Qt::NoBrush);
if (m_dirMode) {
path = makeOpenArrow(getDirection(), m_size,m_size/3.0); //broad arrow?
} else {
path = makeOpenArrow(m_size,m_size/3.0,isFlipped());
}
} else if (m_style == 2) {
setFill(Qt::NoBrush);
setFillStyle(Qt::NoBrush);
if (m_dirMode) {
path = makeHashMark(getDirection(), m_size/2.0,m_size/2.0); //big enough?
} else {
path = makeHashMark(m_size/2.0,m_size/2.0,isFlipped()); //big enough?
}
} else if (m_style == 3) {
setFill(Qt::SolidPattern);
setFillStyle(Qt::SolidPattern);
path = makeDot(m_size/2.0,m_size/2.0,isFlipped());
} else if (m_style == 4) {
path = makeOpenDot(m_size/2.0,m_size/2.0,isFlipped());
} else if (m_style == 5) {
setFill(Qt::NoBrush);
setFillStyle(Qt::NoBrush);
if (m_dirMode) {
path = makeForkArrow(getDirection(), m_size/2.0,m_size/2.0); //big enough?
} else {
@@ -119,7 +119,7 @@ QPainterPath QGIArrow::makeFilledTriangle(double length, double width, bool flip
path.lineTo(QPointF(Rez::guiX(length),Rez::guiX(-width)));
path.lineTo(QPointF(Rez::guiX(length),Rez::guiX(width)));
path.closeSubpath();
setFill(Qt::SolidPattern);
setFillStyle(Qt::SolidPattern);
return path;
}
@@ -138,7 +138,7 @@ QPainterPath QGIArrow::makeFilledTriangle(Base::Vector3d dir, double length, dou
path.lineTo(QPointF(Rez::guiX(barb1.x),Rez::guiX(barb1.y)));
path.lineTo(QPointF(Rez::guiX(barb2.x),Rez::guiX(barb2.y)));
path.closeSubpath();
setFill(Qt::SolidPattern);
setFillStyle(Qt::SolidPattern);
return path;
}
@@ -153,7 +153,7 @@ QPainterPath QGIArrow::makeOpenArrow(double length, double width, bool flipped)
path.moveTo(QPointF(Rez::guiX(length),Rez::guiX(-width)));
path.lineTo(QPointF(0.,0.));
path.lineTo(QPointF(Rez::guiX(length),Rez::guiX(width)));
m_fill = Qt::NoBrush;
setFillStyle(Qt::NoBrush);
return path;
}
@@ -170,7 +170,7 @@ QPainterPath QGIArrow::makeOpenArrow(Base::Vector3d dir, double length, double w
path.moveTo(QPointF(Rez::guiX(barb1.x),Rez::guiX(barb1.y)));
path.lineTo(QPointF(0.,0.));
path.lineTo(QPointF(Rez::guiX(barb2.x),Rez::guiX(barb2.y)));
m_fill = Qt::NoBrush;
setFillStyle(Qt::NoBrush);
return path;
}
@@ -186,7 +186,7 @@ QPainterPath QGIArrow::makeHashMark(double length, double width, bool flipped)
QPainterPath path;
path.moveTo(QPointF(Rez::guiX(length),Rez::guiX(adjWidth * (-width))));
path.lineTo(QPointF(Rez::guiX(-length),Rez::guiX(adjWidth * width)));
m_fill = Qt::NoBrush;
setFillStyle(Qt::NoBrush);
return path;
}
@@ -204,7 +204,7 @@ QPainterPath QGIArrow::makeHashMark(Base::Vector3d dir, double length, double wi
QPainterPath path;
path.moveTo(QPointF(Rez::guiX(barb1.x),Rez::guiX(barb1.y)));
path.lineTo(QPointF(Rez::guiX(barb2.x),Rez::guiX(barb2.y)));
m_fill = Qt::NoBrush;
setFillStyle(Qt::NoBrush);
return path;
}
@@ -214,7 +214,7 @@ QPainterPath QGIArrow::makeDot(double length, double width, bool flipped) //cl
QPainterPath path;
path.moveTo(0.0,0.0); ////(0,0) is Center of dot
path.addEllipse(Rez::guiX(-length/2.0), Rez::guiX(-width/2.0), Rez::guiX(length), Rez::guiX(width));
m_fill = Qt::SolidPattern;
setFillStyle(Qt::SolidPattern);
return path;
}
@@ -224,7 +224,7 @@ QPainterPath QGIArrow::makeOpenDot(double length, double width, bool flipped)
QPainterPath path;
path.moveTo(0.0,0.0); ////(0,0) is Center of dot
path.addEllipse(Rez::guiX(-length/2.0), Rez::guiX(-width/2.0), Rez::guiX(length), Rez::guiX(width));
m_fill = Qt::NoBrush;
setFillStyle(Qt::NoBrush);
return path;
}
@@ -239,7 +239,7 @@ QPainterPath QGIArrow::makeForkArrow(double length, double width, bool flipped)
path.moveTo(QPointF(Rez::guiX(length),Rez::guiX(-width)));
path.lineTo(QPointF(0.,0.));
path.lineTo(QPointF(Rez::guiX(length),Rez::guiX(width)));
m_fill = Qt::NoBrush;
setFillStyle(Qt::NoBrush);
return path;
}
@@ -258,7 +258,7 @@ QPainterPath QGIArrow::makeForkArrow(Base::Vector3d dir, double length, double w
path.moveTo(QPointF(Rez::guiX(barb1.x),Rez::guiX(barb1.y)));
path.lineTo(QPointF(0.,0.));
path.lineTo(QPointF(Rez::guiX(barb2.x),Rez::guiX(barb2.y)));
m_fill = Qt::NoBrush;
setFillStyle(Qt::NoBrush);
return path;
}

View File

@@ -103,10 +103,16 @@ QGILeaderLine::QGILeaderLine(QGraphicsItem* myParent,
m_arrow1 = new QGIArrow();
addToGroup(m_arrow1);
m_arrow1->setNormalColor(getNormalColor());
m_arrow1->setFillColor(getNormalColor());
m_arrow1->setPrettyNormal();
m_arrow1->setPos(0.0,0.0);
m_arrow1->hide();
m_arrow2 = new QGIArrow();
addToGroup(m_arrow2);
m_arrow2->setNormalColor(getNormalColor());
m_arrow2->setFillColor(getNormalColor());
m_arrow2->setPrettyNormal();
m_arrow2->setPos(0.0, 0.0);
m_arrow2->hide();
@@ -363,7 +369,7 @@ void QGILeaderLine::draw()
return;
}
m_line->setFill(Qt::NoBrush);
m_line->setFillStyle(Qt::NoBrush);
m_line->setStyle(m_lineStyle);
double scaler = 1.0;
m_line->setWidth(scaler * m_lineWidth);
@@ -455,7 +461,7 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
m_arrow1->setDirMode(true);
m_arrow1->setDirection(stdX);
m_arrow1->setNormalColor(m_lineColor);
m_arrow1->setFillColor(m_lineColor);
if (pathPoints.size() > 1) {
auto it = pathPoints.begin();
QPointF s = (*it);
@@ -477,6 +483,7 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
m_arrow2->setDirMode(true);
m_arrow2->setDirection(-stdX);
m_arrow2->setNormalColor(m_lineColor);
m_arrow2->setFillColor(getNormalColor());
if (pathPoints.size() > 1) {
auto itr = pathPoints.rbegin();
QPointF s = (*itr);