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
667be75e
Commit
667be75e
authored
Sep 06, 2012
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue 862
parent
e69ffc40
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
20 deletions
+45
-20
UBBoardController.cpp
src/board/UBBoardController.cpp
+23
-7
UBBoardController.h
src/board/UBBoardController.h
+1
-1
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+1
-1
UBGraphicsPolygonItem.cpp
src/domain/UBGraphicsPolygonItem.cpp
+1
-0
UBGraphicsStrokesGroup.cpp
src/domain/UBGraphicsStrokesGroup.cpp
+19
-11
No files found.
src/board/UBBoardController.cpp
View file @
667be75e
...
...
@@ -533,7 +533,7 @@ void UBBoardController::duplicateScene()
duplicateScene
(
mActiveSceneIndex
);
}
void
UBBoardController
::
duplicateItem
(
UBItem
*
item
)
void
UBBoardController
::
duplicateItem
(
UBItem
*
item
,
QTransform
trf
)
{
if
(
!
item
)
return
;
...
...
@@ -553,6 +553,7 @@ void UBBoardController::duplicateItem(UBItem *item)
qreal
shifting
=
UBSettings
::
settings
()
->
objectFrameWidth
;
itemPos
=
commonItem
->
pos
()
+
QPointF
(
shifting
,
shifting
);
itemSize
=
commonItem
->
boundingRect
().
size
();
commonItem
->
setSelected
(
false
);
}
UBMimeType
::
Enum
itemMimeType
;
...
...
@@ -611,18 +612,28 @@ void UBBoardController::duplicateItem(UBItem *item)
{
UBGraphicsGroupContainerItem
*
groupItem
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
item
);
if
(
groupItem
){
QTransform
groupTransform
=
groupItem
->
transform
();
groupItem
->
resetTransform
();
QList
<
QGraphicsItem
*>
children
=
groupItem
->
childItems
();
foreach
(
QGraphicsItem
*
pIt
,
children
){
UBItem
*
pItem
=
dynamic_cast
<
UBItem
*>
(
pIt
);
if
(
NULL
!=
pItem
){
duplicateItem
(
pItem
);
// The duplication already copies the item parameters
if
(
NULL
!=
mLastCreatedItem
){
mLastCreatedItem
->
setSelected
(
true
);
}
duplicateItem
(
pItem
,
groupItem
->
transform
());
// The duplication already copies the item parameters
}
}
groupItem
->
setTransform
(
groupTransform
);
groupItem
->
setSelected
(
false
);
UBApplication
::
mainWindow
->
actionGroupItems
->
trigger
();
QList
<
QGraphicsItem
*>
selItems
=
mActiveScene
->
selectedItems
();
if
(
!
selItems
.
empty
()){
// I don't like this solution but for now this is the only way I found.
// Normally, at this state, only the duplicated group should be selected
UBGraphicsGroupContainerItem
*
duplicatedGroup
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
selItems
.
at
(
0
));
if
(
NULL
!=
duplicatedGroup
){
duplicatedGroup
->
setTransform
(
groupTransform
);
}
}
}
return
;
break
;
...
...
@@ -633,10 +644,11 @@ void UBBoardController::duplicateItem(UBItem *item)
QGraphicsItem
*
gitem
=
dynamic_cast
<
QGraphicsItem
*>
(
item
->
deepCopy
());
if
(
gitem
)
{
qDebug
()
<<
"Adding a stroke: "
<<
gitem
;
mActiveScene
->
addItem
(
gitem
);
gitem
->
setPos
(
itemPos
);
mLastCreatedItem
=
gitem
;
gitem
->
setSelected
(
true
);
}
return
;
}
break
;
...
...
@@ -652,6 +664,7 @@ void UBBoardController::duplicateItem(UBItem *item)
if
(
createdGitem
)
createdGitem
->
setPos
(
itemPos
);
mLastCreatedItem
=
dynamic_cast
<
QGraphicsItem
*>
(
createdItem
);
mLastCreatedItem
->
setSelected
(
true
);
}
}
...
...
@@ -2175,7 +2188,10 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
{
foreach
(
UBItem
*
item
,
mimeData
->
items
())
{
duplicateItem
(
item
);
QGraphicsItem
*
pItem
=
dynamic_cast
<
QGraphicsItem
*>
(
item
);
if
(
NULL
!=
pItem
){
duplicateItem
(
item
,
pItem
->
transform
());
}
}
return
;
...
...
src/board/UBBoardController.h
View file @
667be75e
...
...
@@ -158,7 +158,7 @@ class UBBoardController : public UBDocumentContainer
void
moveSceneToIndex
(
int
source
,
int
target
);
void
duplicateScene
(
int
index
);
void
duplicateItem
(
UBItem
*
item
);
void
duplicateItem
(
UBItem
*
item
,
QTransform
trf
);
void
deleteScene
(
int
index
);
bool
cacheIsVisible
()
{
return
mCacheWidgetIsEnabled
;}
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
667be75e
...
...
@@ -417,7 +417,7 @@ bool UBGraphicsItemDelegate::isLocked() const
void
UBGraphicsItemDelegate
::
duplicate
()
{
UBApplication
::
boardController
->
duplicateItem
(
dynamic_cast
<
UBItem
*>
(
delegated
()));
UBApplication
::
boardController
->
duplicateItem
(
dynamic_cast
<
UBItem
*>
(
delegated
())
,
delegated
()
->
transform
()
);
}
void
UBGraphicsItemDelegate
::
increaseZLevelUp
()
...
...
src/domain/UBGraphicsPolygonItem.cpp
View file @
667be75e
...
...
@@ -173,6 +173,7 @@ void UBGraphicsPolygonItem::copyItemParameters(UBItem *copy) const
cp
->
setColorOnDarkBackground
(
this
->
colorOnDarkBackground
());
cp
->
setColorOnLightBackground
(
this
->
colorOnLightBackground
());
//cp->setTransform(transform());
cp
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
this
->
data
(
UBGraphicsItemData
::
ItemLayerType
));
}
...
...
src/domain/UBGraphicsStrokesGroup.cpp
View file @
667be75e
...
...
@@ -65,25 +65,33 @@ void UBGraphicsStrokesGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
UBItem
*
UBGraphicsStrokesGroup
::
deepCopy
()
const
{
UBGraphicsStrokesGroup
*
copy
=
new
UBGraphicsStrokesGroup
();
UBGraphicsStrokesGroup
*
copy
=
new
UBGraphicsStrokesGroup
();
QTransform
groupTransform
=
transform
();
const_cast
<
UBGraphicsStrokesGroup
*>
(
this
)
->
resetTransform
();
QList
<
QGraphicsItem
*>
chl
=
childItems
();
QList
<
QGraphicsItem
*>
chl
=
childItems
();
foreach
(
QGraphicsItem
*
child
,
chl
)
{
UBGraphicsPolygonItem
*
polygon
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
child
);
if
(
polygon
)
copy
->
addToGroup
(
dynamic_cast
<
QGraphicsItem
*>
(
polygon
->
deepCopy
()));
}
copyItemParameters
(
copy
);
foreach
(
QGraphicsItem
*
child
,
chl
)
{
UBGraphicsPolygonItem
*
polygon
=
dynamic_cast
<
UBGraphicsPolygonItem
*>
(
child
);
if
(
polygon
){
QGraphicsItem
*
pItem
=
dynamic_cast
<
QGraphicsItem
*>
(
polygon
->
deepCopy
());
copy
->
addToGroup
(
pItem
);
}
}
const_cast
<
UBGraphicsStrokesGroup
*>
(
this
)
->
setTransform
(
groupTransform
);
copyItemParameters
(
copy
);
return
copy
;
return
copy
;
}
void
UBGraphicsStrokesGroup
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsStrokesGroup
*
cp
=
dynamic_cast
<
UBGraphicsStrokesGroup
*>
(
copy
);
QGraphicsItem
*
cp
=
dynamic_cast
<
QGraphicsItem
*>
(
copy
);
if
(
NULL
!=
cp
)
{
cp
->
setPos
(
this
->
pos
());
...
...
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