diff --git a/src/tools/UBGraphicsTriangle.cpp b/src/tools/UBGraphicsTriangle.cpp index c18c90a3..8c2e80c8 100644 --- a/src/tools/UBGraphicsTriangle.cpp +++ b/src/tools/UBGraphicsTriangle.cpp @@ -25,8 +25,10 @@ -#include +//#include + #include +#include #include "tools/UBGraphicsTriangle.h" #include "core/UBApplication.h" @@ -131,19 +133,38 @@ void UBGraphicsTriangle::setRect(qreal x, qreal y, qreal w, qreal h, UBGraphicsT polygon << QPointF(x, y) << QPoint(x, y + h) << QPoint(x+w, y + h); setPolygon(polygon); + // Save the bounds rect + bounds_rect.setX(x); bounds_rect.setY(y); bounds_rect.setWidth(w); bounds_rect.setHeight(h); + setOrientation(orientation); } void UBGraphicsTriangle::setOrientation(UBGraphicsTriangleOrientation orientation) { mOrientation = orientation; - calculatePoints(boundingRect()); + + //calculatePoints(boundingRect()); + calculatePoints(bounds_rect); QPolygonF polygon; polygon << A1 << B1 << C1; setPolygon(polygon); } + +QRectF UBGraphicsTriangle::bounding_Rect() const +{ + + QRectF bounds = QRectF(0,0,0,0); + bounds.setX(bounds_rect.x()); + bounds.setY(bounds_rect.y()); + bounds.setWidth(bounds_rect.width()); + bounds.setHeight(bounds_rect.height()); + + + return bounds; +} + UBGraphicsScene* UBGraphicsTriangle::scene() const { return static_cast(QGraphicsPolygonItem::scene()); @@ -151,6 +172,8 @@ UBGraphicsScene* UBGraphicsTriangle::scene() const void UBGraphicsTriangle::calculatePoints(const QRectF& r) { + //qDebug() << "UBGraphicsTriangle calculatePoints()"<<"r ="<setTransform(antiScaleTransform); mCloseSvgItem->setPos(closeButtonRect().topLeft()); + + qDebug() << "UBGraphicsTriangle Paint"<<"closeButtonRect().topLeft()=" + <setPos(hFlipRect().topLeft()); mVFlipSvgItem->setPos(vFlipRect().topLeft()); mRotateSvgItem->setPos(rotateRect().topLeft()); @@ -289,6 +316,8 @@ void UBGraphicsTriangle::paint(QPainter *painter, const QStyleOptionGraphicsItem if (mShowButtons || mResizing2) painter->drawPolygon(resize2Polygon()); } + + } QPainterPath UBGraphicsTriangle::shape() const @@ -296,6 +325,8 @@ QPainterPath UBGraphicsTriangle::shape() const QPainterPath tShape; QPolygonF tPolygon; + qDebug() << "UBGraphicsTriangle shape()"<<"A1 ="<