Fix GH Issue 49 Clip artifact

This commit is contained in:
WandererFan 2016-07-22 14:42:51 -04:00 committed by wmayer
parent 222492c912
commit aa8fea7ba4
5 changed files with 18 additions and 13 deletions

View File

@ -59,8 +59,6 @@
using namespace TechDrawGui;
void _debugRect(char* text, QRectF r);
QGIView::QGIView()
:QGraphicsItemGroup(),
locked(false),
@ -298,12 +296,14 @@ void QGIView::draw()
void QGIView::drawBorder()
{
prepareGeometryChange();
if (!borderVisible) {
m_label->hide();
m_border->hide();
return;
}
//double margin = 2.0;
prepareGeometryChange();
m_label->hide();
m_border->hide();
@ -350,10 +350,6 @@ void QGIView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
QStyleOptionGraphicsItem myOption(*option);
myOption.state &= ~QStyle::State_Selected;
if(!borderVisible){
m_label->hide();
m_border->hide();
}
QGraphicsItemGroup::paint(painter, &myOption, widget);
}
@ -377,6 +373,7 @@ QRectF QGIView::boundingRect() const
{
return m_border->rect().adjusted(-2.,-2.,2.,2.); //allow for border line width //TODO: fiddle brect if border off?
}
QColor QGIView::getNormalColor()
{
Base::Reference<ParameterGrp> hGrp = getParmGroupCol();
@ -419,7 +416,7 @@ QString QGIView::getPrefFont()
return QString::fromStdString(fontName);
}
void _debugRect(char* text, QRectF r) {
Base::Console().Message("TRACE - %s - rect: (%.3f,%.3f) x (%.3f,%.3f)\n",text,
void QGIView::dumpRect(char* text, QRectF r) {
Base::Console().Message("DUMP - %s - rect: (%.3f,%.3f) x (%.3f,%.3f)\n",text,
r.left(),r.top(),r.right(),r.bottom());
}

View File

@ -75,7 +75,6 @@ public:
virtual void updateView(bool update = false);
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
virtual QRectF boundingRect() const override;
//virtual QPainterPath shape(void) const;
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
@ -89,6 +88,7 @@ protected:
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
virtual QRectF customChildrenBoundingRect(void);
void dumpRect(char* text, QRectF r);
QColor getNormalColor(void);
QColor getPreColor(void);
@ -117,6 +117,6 @@ protected:
QPen m_decorPen;
};
} // namespace MDIViewPageGui
} // namespace
#endif // DRAWINGGUI_QGRAPHICSITEMVIEW_H

View File

@ -138,6 +138,7 @@ void QGIViewClip::drawClip()
//TODO: why is qgiv never already in a group?
if (qgiv->group() != m_cliparea) {
qgiv->hide();
scene()->removeItem(qgiv);
m_cliparea->addToGroup(qgiv);
qgiv->isInnerView(true);
double x = qgiv->getViewObject()->X.getValue();
@ -172,6 +173,7 @@ void QGIViewClip::drawClip()
}
}
//TODO: at least move to QGIView
QGIView* QGIViewClip::getQGIVByName(std::string name) //should probably be method in MDIViewPage?? but qgiv can't get drawingView? or QGVPage!
{
QList<QGraphicsItem*> qgItems = scene()->items();

View File

@ -272,7 +272,6 @@ void QGIViewPart::updateView(bool update)
void QGIViewPart::draw() {
drawViewPart();
drawBorder();
QGIView::draw();
}
void QGIViewPart::drawViewPart()
@ -595,3 +594,8 @@ void QGIViewPart::dumpPath(const char* text,QPainterPath path)
elem.type,typeName,elem.x,elem.y,elem.isMoveTo(),elem.isLineTo(),elem.isCurveTo());
}
}
QRectF QGIViewPart::boundingRect() const
{
return childrenBoundingRect();
}

View File

@ -28,6 +28,7 @@
#include <Base/Parameter.h>
#include <Mod/TechDraw/App/Geometry.h>
#include "QGCustomBorder.h"
#include "QGIView.h"
namespace TechDraw {
@ -56,6 +57,7 @@ public:
void setViewPartFeature(TechDraw::DrawViewPart *obj);
virtual void updateView(bool update = false) override;
void tidy();
virtual QRectF boundingRect() const override;
virtual void draw() override;
@ -90,6 +92,6 @@ private:
QList<QGraphicsItem*> deleteItems;
};
} // namespace MDIViewPageGui
} // namespace
#endif // DRAWINGGUI_QGRAPHICSITEMVIEWPART_H