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
535c731a
Commit
535c731a
authored
Mar 30, 2012
by
Ivan Ilin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
cd7bfd39
b45c784e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
31 deletions
+70
-31
UBGraphicsDelegateFrame.cpp
src/domain/UBGraphicsDelegateFrame.cpp
+51
-31
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+9
-0
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+6
-0
UBGraphicsPixmapItem.cpp
src/domain/UBGraphicsPixmapItem.cpp
+4
-0
No files found.
src/domain/UBGraphicsDelegateFrame.cpp
View file @
535c731a
...
...
@@ -210,6 +210,9 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if
(
resizingBottomRight
())
{
// -----------------------------------------------------
// ! We want to keep the aspect ratio with this resize !
// -----------------------------------------------------
qreal
scaleX
=
(
width
+
moveX
)
/
width
;
qreal
scaleY
=
(
height
+
moveY
)
/
height
;
qreal
scaleFactor
=
(
scaleX
+
scaleY
)
/
2
;
...
...
@@ -230,39 +233,56 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
mScaleY
=
scaleY
;
}
}
}
else
if
(
resizingLeft
())
}
else
if
(
resizingLeft
()
||
resizingRight
())
{
qreal
scaleX
=
(
width
-
moveX
)
/
width
;
if
(
scaleX
>
1
||
(
width
*
scaleX
)
>
2
*
mFrameWidth
)
{
mScaleX
=
scaleX
;
mTranslateX
=
moveX
;
}
}
else
if
(
resizingRight
())
{
qreal
scaleX
=
(
width
+
moveX
)
/
width
;
if
(
scaleX
>
1
||
(
width
*
scaleX
)
>
2
*
mFrameWidth
)
{
mScaleX
=
scaleX
;
}
}
else
if
(
resizingTop
())
{
qreal
scaleY
=
(
height
-
moveY
)
/
height
;
if
(
scaleY
>
1
||
(
height
*
scaleY
)
>
2
*
mFrameWidth
)
{
mScaleY
=
scaleY
;
mTranslateY
=
moveY
;
if
(
width
!=
0
){
qreal
scaleX
=
0.0
;
if
(
resizingLeft
()){
scaleX
=
(
width
-
moveX
)
/
width
;
}
else
if
(
resizingRight
()){
scaleX
=
(
width
+
moveX
)
/
width
;
}
if
(
mDelegate
->
isFlippable
()
&&
qAbs
(
scaleX
)
!=
0
){
if
((
width
*
qAbs
(
scaleX
))
<
2
*
mFrameWidth
){
bool
negative
=
(
scaleX
<
0
)
?
true
:
false
;
if
(
negative
){
scaleX
=
-
2
*
mFrameWidth
/
width
;
}
else
{
scaleX
=
2
*
mFrameWidth
/
width
;
}
}
mScaleX
=
scaleX
;
}
else
if
(
scaleX
>
1
||
(
width
*
scaleX
)
>
2
*
mFrameWidth
){
mScaleX
=
scaleX
;
if
(
resizingLeft
()){
mTranslateX
=
moveX
;
}
}
}
}
else
if
(
resizingBottom
())
{
qreal
scaleY
=
(
height
+
moveY
)
/
height
;
if
(
scaleY
>
1
||
(
height
*
scaleY
)
>
2
*
mFrameWidth
)
{
mScaleY
=
scaleY
;
}
else
if
(
resizingTop
()
||
resizingBottom
()){
if
(
height
!=
0
){
qreal
scaleY
=
0.0
;
if
(
resizingTop
()){
scaleY
=
(
height
-
moveY
)
/
height
;
}
else
if
(
resizingBottom
()){
scaleY
=
(
height
+
moveY
)
/
height
;
}
if
(
mDelegate
->
isFlippable
()
&&
qAbs
(
scaleY
)
!=
0
){
if
((
height
*
qAbs
(
scaleY
))
<
2
*
mFrameWidth
){
bool
negative
=
(
scaleY
<
0
)
?
true
:
false
;
if
(
negative
){
scaleY
=
-
2
*
mFrameWidth
/
width
;
}
else
{
scaleY
=
2
*
mFrameWidth
/
width
;
}
}
mScaleY
=
scaleY
;
}
else
if
(
scaleY
>
1
||
(
height
*
scaleY
)
>
2
*
mFrameWidth
)
{
mScaleY
=
scaleY
;
mTranslateY
=
moveY
;
}
}
}
}
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
535c731a
...
...
@@ -64,6 +64,7 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
,
mCanDuplicate
(
true
)
,
mRespectRatio
(
respectRatio
)
,
mMimeData
(
NULL
)
,
mFlippable
(
false
)
{
// NOOP
}
...
...
@@ -486,4 +487,12 @@ void UBGraphicsItemDelegate::showMenu()
mMenu
->
exec
(
cv
->
mapToGlobal
(
pinPos
.
bottomRight
()));
}
void
UBGraphicsItemDelegate
::
setFlippable
(
bool
flippable
)
{
mFlippable
=
flippable
;
}
bool
UBGraphicsItemDelegate
::
isFlippable
()
{
return
mFlippable
;
}
src/domain/UBGraphicsItemDelegate.h
View file @
535c731a
...
...
@@ -136,6 +136,9 @@ class UBGraphicsItemDelegate : public QObject
QMimeData
*
mimeData
(){
return
mMimeData
;
}
void
setMimeData
(
QMimeData
*
mimeData
);
void
setFlippable
(
bool
flippable
);
bool
isFlippable
();
signals
:
void
showOnDisplayChanged
(
bool
shown
);
void
lockChanged
(
bool
locked
);
...
...
@@ -196,6 +199,9 @@ private:
bool
mCanDuplicate
;
bool
mRespectRatio
;
QMimeData
*
mMimeData
;
/** A boolean saying that this object can be flippable (mirror effect) */
bool
mFlippable
;
};
...
...
src/domain/UBGraphicsPixmapItem.cpp
View file @
535c731a
...
...
@@ -30,6 +30,10 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
{
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
,
true
);
mDelegate
->
init
();
// NOTE: Do not remove this code, I'm just doing a backup of my changes! thx..
//mDelegate->setFlippable(true);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setTransformationMode
(
Qt
::
SmoothTransformation
);
...
...
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