Fix "trails" on dim lines when zoomed in
This commit is contained in:
@@ -50,11 +50,21 @@ void QGIDimLines::draw()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF QGIDimLines::boundingRect() 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);
|
||||
}
|
||||
|
||||
//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
|
||||
|
||||
QGIPrimPath::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 175};
|
||||
int type() const { return Type;}
|
||||
QRectF boundingRect() const;
|
||||
|
||||
public:
|
||||
void draw();
|
||||
|
||||
@@ -1268,8 +1268,9 @@ void QGIViewDimension::draw()
|
||||
ccwInner = false;
|
||||
}
|
||||
|
||||
double dimLineAdjust = Rez::guiX(QGIArrow::getOverlapAdjust(QGIArrow::getPrefArrowStyle(),
|
||||
QGIArrow::getPrefArrowSize()));
|
||||
//TODO: figure out the math for adjusting the arc so the tip doesn't overlap the arrowhead.
|
||||
// double dimLineAdjust = Rez::guiX(QGIArrow::getOverlapAdjust(QGIArrow::getPrefArrowStyle(),
|
||||
// QGIArrow::getPrefArrowSize()));
|
||||
QRectF mappedRect = mapRectFromItem(datumLabel, datumLabel->boundingRect());
|
||||
lblCenter = Base::Vector3d(mappedRect.center().x(), mappedRect.center().y(), 0.0);
|
||||
|
||||
@@ -1473,6 +1474,8 @@ void QGIViewDimension::paint ( QPainter * painter, const QStyleOptionGraphicsIte
|
||||
} else {
|
||||
setPens();
|
||||
}
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
QGIView::paint (painter, &myOption, widget);
|
||||
setPens();
|
||||
}
|
||||
@@ -1589,4 +1592,10 @@ double QGIViewDimension::getDefaultTextVerticalOffset() const
|
||||
return textMult*Rez::guiX(vp->Fontsize.getValue()) + TextOffsetFudge;
|
||||
}
|
||||
|
||||
QRectF QGIViewDimension::boundingRect() const
|
||||
{
|
||||
return childrenBoundingRect().adjusted(-3,-3,3,3);
|
||||
}
|
||||
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_QGIViewDimension.cpp>
|
||||
|
||||
@@ -130,12 +130,13 @@ public:
|
||||
|
||||
void setViewPartFeature(TechDraw::DrawViewDimension *obj);
|
||||
int type() const override { return Type;}
|
||||
|
||||
virtual void drawBorder() override;
|
||||
virtual void updateView(bool update = false) override;
|
||||
QRectF boundingRect() const;
|
||||
virtual void paint( QPainter * painter,
|
||||
const QStyleOptionGraphicsItem * option,
|
||||
QWidget * widget = 0 ) override;
|
||||
|
||||
virtual void drawBorder() override;
|
||||
virtual void updateView(bool update = false) override;
|
||||
virtual QColor getNormalColor(void) override;
|
||||
QString getLabelText(void);
|
||||
|
||||
|
||||
@@ -1058,6 +1058,16 @@ QRectF QGIViewPart::boundingRect() const
|
||||
return QGIView::boundingRect();
|
||||
}
|
||||
|
||||
void QGIViewPart::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
QGIView::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
|
||||
//QGIViewPart derived classes do not need a rotate view method as rotation is handled on App side.
|
||||
void QGIViewPart::rotateView(void)
|
||||
{
|
||||
|
||||
@@ -51,6 +51,9 @@ public:
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 102};
|
||||
int type() const override { return Type;}
|
||||
virtual void paint( QPainter * painter,
|
||||
const QStyleOptionGraphicsItem * option,
|
||||
QWidget * widget = 0 ) override;
|
||||
|
||||
|
||||
void toggleCache(bool state) override;
|
||||
|
||||
Reference in New Issue
Block a user