[TD]prevent bleed through on Detail mat
This commit is contained in:
@@ -41,7 +41,8 @@
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIMatting::QGIMatting() :
|
||||
m_radius(5.0)
|
||||
m_radius(5.0),
|
||||
m_fudge(1.01) // same as m_fudge in DrawViewDetail
|
||||
|
||||
{
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
@@ -58,25 +59,48 @@ QGIMatting::QGIMatting() :
|
||||
m_border->setPen(m_pen);
|
||||
m_border->setBrush(m_brush);
|
||||
|
||||
m_mat = new QGraphicsPathItem();
|
||||
addToGroup(m_mat);
|
||||
m_matPen.setColor(Qt::white);
|
||||
m_matPen.setStyle(Qt::SolidLine);
|
||||
m_matBrush.setStyle(Qt::SolidPattern);
|
||||
m_matBrush.setColor(Qt::white);
|
||||
m_mat->setPen(m_matPen);
|
||||
m_mat->setBrush(m_matBrush);
|
||||
|
||||
setZValue(ZVALUE::MATTING);
|
||||
}
|
||||
|
||||
void QGIMatting::draw()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
double penWidth = Rez::guiX(TechDraw::LineGroup::getDefaultWidth("Graphic"));
|
||||
double penWidth_2 = penWidth / 2.0;
|
||||
m_pen.setWidthF(penWidth);
|
||||
double matSize = m_radius * m_fudge + 2 * penWidth; // outer bound of mat
|
||||
m_matPen.setWidthF(2.0 * penWidth);
|
||||
QPainterPath ppCut;
|
||||
QPainterPath ppMat;
|
||||
if (getHoleStyle() == 0) {
|
||||
QRectF roundCutout (-m_radius, -m_radius, 2.0 * m_radius, 2.0 * m_radius);
|
||||
ppCut.addEllipse(roundCutout);
|
||||
QRectF roundMat(-matSize, -matSize, 2.0 * matSize, 2.0 * matSize);
|
||||
ppMat.addEllipse(roundMat);
|
||||
ppMat.addEllipse(roundCutout.adjusted(-penWidth_2, -penWidth_2, penWidth_2, penWidth_2));
|
||||
} else {
|
||||
double squareSize = m_radius;
|
||||
QRectF squareCutout (-squareSize, -squareSize, 2.0 * squareSize, 2.0 * squareSize);
|
||||
ppCut.addRect(squareCutout);
|
||||
QRectF squareMat(-matSize, -matSize, 2.0 * matSize, 2.0 * matSize);
|
||||
ppMat.addRect(squareMat);
|
||||
ppMat.addRect(squareCutout.adjusted(-penWidth_2, -penWidth_2, penWidth_2, penWidth_2));
|
||||
}
|
||||
m_pen.setWidthF(Rez::guiX(TechDraw::LineGroup::getDefaultWidth("Graphic")));
|
||||
m_border->setPen(m_pen);
|
||||
m_border->setPath(ppCut);
|
||||
m_border->setZValue(ZVALUE::MATTING);
|
||||
m_mat->setPen(m_matPen);
|
||||
m_mat->setPath(ppMat);
|
||||
m_mat->setZValue(ZVALUE::MATTING - 1.0);
|
||||
}
|
||||
|
||||
int QGIMatting::getHoleStyle()
|
||||
|
||||
@@ -62,13 +62,17 @@ protected:
|
||||
double m_height;
|
||||
double m_width;
|
||||
double m_radius;
|
||||
double m_fudge;
|
||||
int getHoleStyle();
|
||||
|
||||
QGraphicsPathItem* m_border;
|
||||
QGraphicsPathItem* m_mat;
|
||||
|
||||
private:
|
||||
QPen m_pen;
|
||||
QBrush m_brush;
|
||||
QPen m_matPen;
|
||||
QBrush m_matBrush;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user