Commit 2491e7e3 authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

Graphics Triangle Tool

parent 331a82ff
This diff is collapsed.
...@@ -67,6 +67,8 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt ...@@ -67,6 +67,8 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
protected: protected:
void updateResizeCursor();
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget); virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget);
virtual void rotateAroundCenter(qreal angle); virtual void rotateAroundCenter(qreal angle);
...@@ -80,7 +82,9 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt ...@@ -80,7 +82,9 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
QRectF vFlipRect() const; QRectF vFlipRect() const;
QRectF rotateRect() const; QRectF rotateRect() const;
QCursor moveResizeCursor() const; QCursor resizeCursor1() const;
QCursor resizeCursor2() const;
QCursor flipCursor() const; QCursor flipCursor() const;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
...@@ -92,6 +96,9 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt ...@@ -92,6 +96,9 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
private: private:
QCursor mResizeCursor1;
QCursor mResizeCursor2;
QTransform calculateRotationTransform(); QTransform calculateRotationTransform();
qreal angle; qreal angle;
void rotateAroundCenter(QTransform& transform, QPointF center); void rotateAroundCenter(QTransform& transform, QPointF center);
...@@ -112,9 +119,15 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt ...@@ -112,9 +119,15 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
UBGraphicsTriangleOrientation mOrientation; UBGraphicsTriangleOrientation mOrientation;
QPointF A1, B1, C1, A2, B2, C2; // coordinates of points in ext and int triangles
qreal C;
qreal W1, H1; // Neccessary for filling
QPointF CC; // Hyp. fillining gradient - top point
void calculatePoints(const QRectF& rect);
static const int d = 70; // width of triangle border static const int d = 70; // width of triangle border
static const int sArrowLength = 30; static const int sArrowLength = 30;
static const int sMinWidth = 200; static const int sMinWidth = 380;
static const int sMinHeight = 200; static const int sMinHeight = 200;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment