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
3d3a040b
Commit
3d3a040b
authored
Sep 20, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Plain Diff
Merge fix for resizing of items from aleksei_kanash_dev.
parents
ab25ec27
be07b400
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
160 additions
and
144 deletions
+160
-144
UBBoardView.cpp
src/board/UBBoardView.cpp
+0
-3
UBGraphicsDelegateFrame.cpp
src/domain/UBGraphicsDelegateFrame.cpp
+157
-140
UBGraphicsDelegateFrame.h
src/domain/UBGraphicsDelegateFrame.h
+3
-1
No files found.
src/board/UBBoardView.cpp
View file @
3d3a040b
...
@@ -749,9 +749,6 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
...
@@ -749,9 +749,6 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
void
UBBoardView
::
handleItemMouseMove
(
QMouseEvent
*
event
)
void
UBBoardView
::
handleItemMouseMove
(
QMouseEvent
*
event
)
{
{
if
(
!
movingItem
)
return
;
// determine item to move (maybee we need to move group of item or his parent.
// determine item to move (maybee we need to move group of item or his parent.
movingItem
=
determineItemToMove
(
movingItem
);
movingItem
=
determineItemToMove
(
movingItem
);
...
...
src/domain/UBGraphicsDelegateFrame.cpp
View file @
3d3a040b
...
@@ -224,11 +224,13 @@ void UBGraphicsDelegateFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
...
@@ -224,11 +224,13 @@ void UBGraphicsDelegateFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
mAngleOffset
=
0
;
mAngleOffset
=
0
;
mInitialTransform
=
buildTransform
();
mInitialTransform
=
buildTransform
();
mOriginalSize
=
delegated
()
->
boundingRect
().
size
();
mCurrentTool
=
toolFromPos
(
event
->
pos
());
mCurrentTool
=
toolFromPos
(
event
->
pos
());
setCursorFromAngle
(
QString
::
number
((
int
)
mAngle
%
360
));
setCursorFromAngle
(
QString
::
number
((
int
)
mAngle
%
360
));
event
->
accept
();
event
->
accept
();
if
(
moving
())
prepareFramesToMove
(
getLinkedFrames
());
prepareFramesToMove
(
getLinkedFrames
());
}
}
...
@@ -358,20 +360,25 @@ QSizeF UBGraphicsDelegateFrame::getResizeVector(qreal moveX, qreal moveY)
...
@@ -358,20 +360,25 @@ QSizeF UBGraphicsDelegateFrame::getResizeVector(qreal moveX, qreal moveY)
return
QSizeF
(
dPosX
,
dPosY
);
return
QSizeF
(
dPosX
,
dPosY
);
}
}
void
UBGraphicsDelegateFrame
::
resizeDelegate
(
qreal
moveX
,
qreal
moveY
)
QSizeF
UBGraphicsDelegateFrame
::
resizeDelegate
(
qreal
moveX
,
qreal
moveY
)
{
{
QPointF
fixedPoint
=
getFixedPointFromPos
();
QSizeF
incVector
;
mFixedPoint
=
getFixedPointFromPos
();
UBResizableGraphicsItem
*
resizableItem
=
dynamic_cast
<
UBResizableGraphicsItem
*>
(
delegated
());
UBResizableGraphicsItem
*
resizableItem
=
dynamic_cast
<
UBResizableGraphicsItem
*>
(
delegated
());
if
(
resizableItem
)
if
(
resizableItem
)
{
{
QSizeF
originalSize
=
delegated
()
->
boundingRect
().
size
();
incVector
=
getResizeVector
(
moveX
,
moveY
);
resizableItem
->
resize
(
originalSize
+
getResizeVector
(
moveX
,
moveY
)
);
resizableItem
->
resize
(
mOriginalSize
+
incVector
);
if
(
resizingTop
()
||
resizingLeft
()
||
((
mMirrorX
||
mMirrorY
)
&&
resizingBottomRight
()))
if
(
resizingTop
()
||
resizingLeft
()
||
((
mMirrorX
||
mMirrorY
)
&&
resizingBottomRight
()))
{
{
delegated
()
->
setPos
(
delegated
()
->
pos
()
-
getFixedPointFromPos
()
+
fixedPoint
);
QPointF
pos1
=
getFixedPointFromPos
();
delegated
()
->
setPos
(
delegated
()
->
pos
()
-
pos1
+
mFixedPoint
);
}
}
}
}
return
incVector
;
}
}
void
UBGraphicsDelegateFrame
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
void
UBGraphicsDelegateFrame
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
...
@@ -379,17 +386,14 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -379,17 +386,14 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if
(
None
==
mCurrentTool
)
if
(
None
==
mCurrentTool
)
return
;
return
;
QLineF
move
;
QLineF
move
=
QLineF
(
mStartingPoint
,
event
->
scenePos
());
if
(
rotating
()
||
moving
()
||
mOperationMode
==
Scaling
)
move
=
QLineF
(
mStartingPoint
,
event
->
scenePos
());
else
move
=
QLineF
(
event
->
lastScenePos
(),
event
->
scenePos
());
qreal
moveX
=
move
.
length
()
*
cos
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
qreal
moveX
=
move
.
length
()
*
cos
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
qreal
moveY
=
-
move
.
length
()
*
sin
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
qreal
moveY
=
-
move
.
length
()
*
sin
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
qreal
width
=
delegated
()
->
boundingRect
().
width
()
*
mTotalScaleX
;
qreal
width
=
delegated
()
->
boundingRect
().
width
()
*
mTotalScaleX
;
qreal
height
=
delegated
()
->
boundingRect
().
height
()
*
mTotalScaleY
;
qreal
height
=
delegated
()
->
boundingRect
().
height
()
*
mTotalScaleY
;
if
(
mOperationMode
==
Scaling
)
{
if
(
!
rotating
())
if
(
!
rotating
())
{
{
mTranslateX
=
moveX
;
mTranslateX
=
moveX
;
...
@@ -491,6 +495,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -491,6 +495,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
}
}
}
}
}
if
(
rotating
())
if
(
rotating
())
{
{
...
@@ -531,6 +536,8 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -531,6 +536,8 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
moveLinkedItems
(
move
);
moveLinkedItems
(
move
);
}
}
if
(
mOperationMode
==
Scaling
||
moving
()
||
rotating
())
{
QTransform
tr
=
buildTransform
();
QTransform
tr
=
buildTransform
();
if
(
resizingRight
()
||
resizingBottom
()
||
resizingBottomRight
())
if
(
resizingRight
()
||
resizingBottom
()
||
resizingBottomRight
())
...
@@ -556,39 +563,48 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -556,39 +563,48 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
mTranslateX
+=
fixedPoint
.
x
()
-
bottomRight
.
x
();
mTranslateX
+=
fixedPoint
.
x
()
-
bottomRight
.
x
();
mTranslateY
+=
fixedPoint
.
y
()
-
bottomRight
.
y
();
mTranslateY
+=
fixedPoint
.
y
()
-
bottomRight
.
y
();
}
}
else
if
(
moving
()
||
rotating
())
if
(
mOperationMode
==
Scaling
||
moving
()
||
rotating
())
{
tr
=
buildTransform
();
delegated
()
->
setTransform
(
tr
);
delegated
()
->
setTransform
(
tr
);
}
}
else
if
(
mOperationMode
==
Resizing
)
else
// resizing/resizing horizontally
{
if
(
!
moving
()
&&
!
rotating
())
{
{
if
(
resizingBottomRight
())
if
(
resizingBottomRight
())
{
{
static
QSizeF
incV
=
QSizeF
();
static
QSizeF
incH
=
QSizeF
();
if
(
mMirrorX
&&
mMirrorY
)
if
(
mMirrorX
&&
mMirrorY
)
mCurrentTool
=
ResizeTop
;
mCurrentTool
=
ResizeTop
;
else
else
mCurrentTool
=
ResizeBottom
;
mCurrentTool
=
ResizeBottom
;
resizeDelegate
(
moveX
,
moveY
);
mOriginalSize
-=
incH
;
incV
=
resizeDelegate
(
moveX
,
moveY
);
mOriginalSize
+=
incV
;
if
(
mMirrorX
&&
mMirrorY
)
if
(
mMirrorX
&&
mMirrorY
)
mCurrentTool
=
ResizeLeft
;
mCurrentTool
=
ResizeLeft
;
else
else
mCurrentTool
=
ResizeRight
;
mCurrentTool
=
ResizeRight
;
resizeDelegate
(
moveX
,
moveY
);
move
=
QLineF
(
event
->
lastScenePos
(),
event
->
scenePos
());
moveX
=
move
.
length
()
*
cos
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
moveY
=
-
move
.
length
()
*
sin
((
move
.
angle
()
-
mAngle
)
*
PI
/
180
);
mFixedPoint
=
getFixedPointFromPos
();
incH
=
resizeDelegate
(
moveX
,
moveY
);
mOriginalSize
-=
incV
;
mOriginalSize
+=
incH
;
mCurrentTool
=
ResizeBottomRight
;
mCurrentTool
=
ResizeBottomRight
;
}
}
else
else
resizeDelegate
(
moveX
,
moveY
);
resizeDelegate
(
moveX
,
moveY
);
}
}
}
event
->
accept
();
event
->
accept
();
}
}
...
@@ -689,6 +705,7 @@ void UBGraphicsDelegateFrame::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
...
@@ -689,6 +705,7 @@ void UBGraphicsDelegateFrame::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
event
->
accept
();
event
->
accept
();
mCurrentTool
=
None
;
mCurrentTool
=
None
;
QGraphicsRectItem
::
mouseReleaseEvent
(
event
);
QGraphicsRectItem
::
mouseReleaseEvent
(
event
);
// Show the buttons
// Show the buttons
...
...
src/domain/UBGraphicsDelegateFrame.h
View file @
3d3a040b
...
@@ -39,7 +39,7 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
...
@@ -39,7 +39,7 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
QPointF
getFixedPointFromPos
();
QPointF
getFixedPointFromPos
();
QSizeF
getResizeVector
(
qreal
moveX
,
qreal
moveY
);
QSizeF
getResizeVector
(
qreal
moveX
,
qreal
moveY
);
void
resizeDelegate
(
qreal
moveX
,
qreal
moveY
);
QSizeF
resizeDelegate
(
qreal
moveX
,
qreal
moveY
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
...
@@ -105,6 +105,8 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
...
@@ -105,6 +105,8 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
QPointF
mStartingPoint
;
QPointF
mStartingPoint
;
QTransform
mInitialTransform
;
QTransform
mInitialTransform
;
QSizeF
mOriginalSize
;
QPointF
mFixedPoint
;
QGraphicsSvgItem
*
mBottomRightResizeGripSvgItem
;
QGraphicsSvgItem
*
mBottomRightResizeGripSvgItem
;
QGraphicsSvgItem
*
mBottomResizeGripSvgItem
;
QGraphicsSvgItem
*
mBottomResizeGripSvgItem
;
...
...
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