Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
de2fb68f
Commit
de2fb68f
authored
Aug 12, 2011
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Triangle resizing bug fix
parent
bba6631b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
355 additions
and
349 deletions
+355
-349
UBGraphicsTriangle.cpp
src/tools/UBGraphicsTriangle.cpp
+291
-287
UBGraphicsTriangle.h
src/tools/UBGraphicsTriangle.h
+64
-62
No files found.
src/tools/UBGraphicsTriangle.cpp
View file @
de2fb68f
This diff is collapsed.
Click to expand it.
src/tools/UBGraphicsTriangle.h
View file @
de2fb68f
...
...
@@ -36,7 +36,7 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
UBGraphicsTriangle
();
virtual
~
UBGraphicsTriangle
();
enum
{
Type
=
UBGraphicsItemType
::
TriangleItemType
};
enum
{
Type
=
UBGraphicsItemType
::
TriangleItemType
};
virtual
int
type
()
const
{
...
...
@@ -44,64 +44,64 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
}
virtual
UBItem
*
deepCopy
(
void
)
const
;
enum
UBGraphicsTriangleOrientation
{
BottomLeft
=
0
,
BottomRight
,
TopLeft
,
TopRight
};
static
UBGraphicsTriangleOrientation
orientationFromStr
(
QStringRef
&
str
)
{
if
(
str
==
"BottomLeft"
)
return
BottomLeft
;
if
(
str
==
"BottomRight"
)
return
BottomRight
;
if
(
str
==
"TopLeft"
)
return
TopLeft
;
if
(
str
==
"TopRight"
)
return
TopRight
;
return
sDefaultOrientation
;
}
void
setRect
(
const
QRectF
&
rect
,
UBGraphicsTriangleOrientation
orientation
)
{
setRect
(
rect
.
x
(),
rect
.
y
(),
rect
.
width
(),
rect
.
height
(),
orientation
);
}
void
setRect
(
qreal
x
,
qreal
y
,
qreal
w
,
qreal
h
,
UBGraphicsTriangleOrientation
orientation
);
void
setOrientation
(
UBGraphicsTriangleOrientation
orientation
);
QRectF
rect
()
const
{
return
boundingRect
();}
UBGraphicsScene
*
scene
()
const
;
protected
:
virtual
UBItem
*
deepCopy
(
void
)
const
;
enum
UBGraphicsTriangleOrientation
{
BottomLeft
=
0
,
BottomRight
,
TopLeft
,
TopRight
};
static
UBGraphicsTriangleOrientation
orientationFromStr
(
QStringRef
&
str
)
{
if
(
str
==
"BottomLeft"
)
return
BottomLeft
;
if
(
str
==
"BottomRight"
)
return
BottomRight
;
if
(
str
==
"TopLeft"
)
return
TopLeft
;
if
(
str
==
"TopRight"
)
return
TopRight
;
return
sDefaultOrientation
;
}
void
setRect
(
const
QRectF
&
rect
,
UBGraphicsTriangleOrientation
orientation
)
{
setRect
(
rect
.
x
(),
rect
.
y
(),
rect
.
width
(),
rect
.
height
(),
orientation
);
}
void
setRect
(
qreal
x
,
qreal
y
,
qreal
w
,
qreal
h
,
UBGraphicsTriangleOrientation
orientation
);
void
setOrientation
(
UBGraphicsTriangleOrientation
orientation
);
QRectF
rect
()
const
{
return
boundingRect
();}
UBGraphicsScene
*
scene
()
const
;
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
);
virtual
QPointF
rotationCenter
()
const
;
virtual
QPointF
rotationCenter
()
const
;
virtual
QRectF
closeButtonRect
()
const
;
QPolygonF
resize1Polygon
()
const
;
QPolygonF
resize2Polygon
()
const
;
QRectF
hFlipRect
()
const
;
QRectF
vFlipRect
()
const
;
QRectF
rotateRect
()
const
;
virtual
QRectF
closeButtonRect
()
const
;
QPolygonF
resize1Polygon
()
const
;
QPolygonF
resize2Polygon
()
const
;
QRectF
hFlipRect
()
const
;
QRectF
vFlipRect
()
const
;
QRectF
rotateRect
()
const
;
QCursor
resizeCursor1
()
const
;
QCursor
resizeCursor2
()
const
;
QCursor
resizeCursor1
()
const
;
QCursor
resizeCursor2
()
const
;
QCursor
flipCursor
()
const
;
QCursor
flipCursor
()
const
;
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
);
private
:
private
:
QCursor
mResizeCursor1
;
QCursor
mResizeCursor2
;
...
...
@@ -110,21 +110,23 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
qreal
angle
;
void
rotateAroundCenter
(
QTransform
&
transform
,
QPointF
center
);
bool
mResizing1
;
bool
mResizing2
;
bool
mRotating
;
bool
mResizing1
;
bool
mResizing2
;
bool
mRotating
;
QRect
lastRect
;
QPoint
lastPos
;
QGraphicsSvgItem
*
mHFlipSvgItem
;
QGraphicsSvgItem
*
mVFlipSvgItem
;
QGraphicsSvgItem
*
mRotateSvgItem
;
QGraphicsSvgItem
*
mHFlipSvgItem
;
QGraphicsSvgItem
*
mVFlipSvgItem
;
QGraphicsSvgItem
*
mRotateSvgItem
;
static
const
QRect
sDefaultRect
;
static
const
UBGraphicsTriangleOrientation
sDefaultOrientation
;
static
const
QRect
sDefaultRect
;
static
const
UBGraphicsTriangleOrientation
sDefaultOrientation
;
void
paintGraduations
(
QPainter
*
painter
);
void
paintGraduations
(
QPainter
*
painter
);
UBGraphicsTriangleOrientation
mOrientation
;
UBGraphicsTriangleOrientation
mOrientation
;
QPointF
A1
,
B1
,
C1
,
A2
,
B2
,
C2
;
// coordinates of points in ext and int triangles
qreal
C
;
...
...
@@ -132,10 +134,10 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
QPointF
CC
;
// Hyp. fillining gradient - top point
void
calculatePoints
(
const
QRectF
&
rect
);
static
const
int
d
=
70
;
// width of triangle border
static
const
int
sArrowLength
=
30
;
static
const
int
sMinWidth
=
380
;
static
const
int
sMinHeight
=
200
;
static
const
int
d
=
70
;
// width of triangle border
static
const
int
sArrowLength
=
30
;
static
const
int
sMinWidth
=
380
;
static
const
int
sMinHeight
=
200
;
};
#endif
/* UBGRAPHICSTRIANGLE_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment