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
f84d2042
Commit
f84d2042
authored
Apr 28, 2014
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed hack and correct duplication on a group
parent
aaa09c99
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
19 deletions
+34
-19
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+1
-1
UBGraphicsGroupContainerItem.cpp
src/domain/UBGraphicsGroupContainerItem.cpp
+14
-2
UBGraphicsGroupContainerItem.h
src/domain/UBGraphicsGroupContainerItem.h
+1
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+18
-14
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+0
-2
No files found.
src/core/UBPersistenceManager.cpp
View file @
f84d2042
...
...
@@ -757,7 +757,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
if
(
pScene
->
isModified
())
{
UBThumbnailAdaptor
::
persistScene
(
pDocumentProxy
,
pScene
,
pSceneIndex
);
if
(
forceImmediateSaving
||
pScene
->
hasGroups
()
)
if
(
forceImmediateSaving
)
UBSvgSubsetAdaptor
::
persistScene
(
pDocumentProxy
,
pScene
,
pSceneIndex
);
else
{
UBGraphicsScene
*
copiedScene
=
pScene
->
sceneDeepCopy
();
...
...
src/domain/UBGraphicsGroupContainerItem.cpp
View file @
f84d2042
...
...
@@ -189,13 +189,23 @@ UBCoreGraphicsScene *UBGraphicsGroupContainerItem::corescene()
return
castScene
;
}
UBGraphicsGroupContainerItem
*
UBGraphicsGroupContainerItem
::
deepCopy
()
const
UBGraphicsGroupContainerItem
*
UBGraphicsGroupContainerItem
::
deepCopy
NoChildDuplication
()
const
{
UBGraphicsGroupContainerItem
*
copy
=
new
UBGraphicsGroupContainerItem
();
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as Widgets are imutable
copyItemParameters
(
copy
);
return
copy
;
}
UBGraphicsGroupContainerItem
*
UBGraphicsGroupContainerItem
::
deepCopy
()
const
{
UBGraphicsGroupContainerItem
*
copy
=
new
UBGraphicsGroupContainerItem
();
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as Widgets are imutable
foreach
(
QGraphicsItem
*
it
,
childItems
())
{
UBItem
*
childAsUBItem
=
dynamic_cast
<
UBItem
*>
(
it
);
...
...
@@ -209,6 +219,8 @@ UBGraphicsGroupContainerItem *UBGraphicsGroupContainerItem::deepCopy() const
return
copy
;
}
void
UBGraphicsGroupContainerItem
::
copyItemParameters
(
UBItem
*
copy
)
const
{
UBGraphicsGroupContainerItem
*
cp
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
copy
);
...
...
src/domain/UBGraphicsGroupContainerItem.h
View file @
f84d2042
...
...
@@ -50,6 +50,7 @@ public:
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
virtual
UBCoreGraphicsScene
*
corescene
();
UBGraphicsGroupContainerItem
*
deepCopyNoChildDuplication
()
const
;
virtual
UBGraphicsGroupContainerItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
...
...
src/domain/UBGraphicsScene.cpp
View file @
f84d2042
...
...
@@ -315,7 +315,6 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
,
mpLastPolygon
(
NULL
)
,
mCurrentPolygon
(
0
)
,
mSelectionFrame
(
0
)
,
mNumberOfGroups
(
0
)
{
UBCoreGraphicsScene
::
setObjectName
(
"BoardScene"
);
setItemIndexMethod
(
NoIndex
);
...
...
@@ -1110,12 +1109,25 @@ UBGraphicsScene* UBGraphicsScene::sceneDeepCopy() const
QGraphicsItem
*
cloneItem
=
0
;
UBItem
*
ubItem
=
dynamic_cast
<
UBItem
*>
(
item
);
UBGraphicsStroke
*
stroke
=
dynamic_cast
<
UBGraphicsStroke
*>
(
item
);
UBGraphicsGroupContainerItem
*
group
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
item
);
if
(
group
){
UBGraphicsGroupContainerItem
*
groupCloned
=
group
->
deepCopyNoChildDuplication
();
groupCloned
->
resetMatrix
();
groupCloned
->
resetTransform
();
foreach
(
QGraphicsItem
*
eachItem
,
group
->
childItems
()){
QGraphicsItem
*
copiedChild
=
dynamic_cast
<
QGraphicsItem
*>
(
dynamic_cast
<
UBItem
*>
(
eachItem
)
->
deepCopy
());
copiedChild
->
resetTransform
();
copiedChild
->
resetMatrix
();
copiedChild
->
setMatrix
(
eachItem
->
sceneMatrix
());
copy
->
addItem
(
copiedChild
);
groupCloned
->
addToGroup
(
copiedChild
);
}
copy
->
addItem
(
groupCloned
);
}
if
(
ubItem
&&
!
stroke
)
{
if
(
ubItem
&&
!
stroke
&&
!
group
)
cloneItem
=
dynamic_cast
<
QGraphicsItem
*>
(
ubItem
->
deepCopy
());
}
if
(
cloneItem
)
{
...
...
@@ -1619,8 +1631,6 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q
void
UBGraphicsScene
::
addItem
(
QGraphicsItem
*
item
)
{
UBCoreGraphicsScene
::
addItem
(
item
);
if
(
item
->
type
()
==
UBGraphicsItemType
::
groupContainerType
)
mNumberOfGroups
+=
1
;
// the default z value is already set. This is the case when a svg file is read
if
(
item
->
zValue
()
==
DEFAULT_Z_VALUE
||
item
->
zValue
()
==
UBZLayerController
::
errorNum
()){
...
...
@@ -1650,9 +1660,6 @@ void UBGraphicsScene::addItems(const QSet<QGraphicsItem*>& items)
void
UBGraphicsScene
::
removeItem
(
QGraphicsItem
*
item
)
{
if
(
item
->
type
()
==
UBGraphicsItemType
::
groupContainerType
)
mNumberOfGroups
-=
1
;
item
->
setSelected
(
false
);
UBCoreGraphicsScene
::
removeItem
(
item
);
UBApplication
::
boardController
->
freezeW3CWidget
(
item
,
true
);
...
...
@@ -1668,11 +1675,8 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
void
UBGraphicsScene
::
removeItems
(
const
QSet
<
QGraphicsItem
*>&
items
)
{
foreach
(
QGraphicsItem
*
item
,
items
)
{
if
(
item
->
type
()
==
UBGraphicsItemType
::
groupContainerType
)
mNumberOfGroups
-=
1
;
foreach
(
QGraphicsItem
*
item
,
items
)
UBCoreGraphicsScene
::
removeItem
(
item
);
}
mItemCount
-=
items
.
size
();
...
...
src/domain/UBGraphicsScene.h
View file @
f84d2042
...
...
@@ -348,7 +348,6 @@ public slots:
void
zoomOutMagnifier
();
void
changeMagnifierMode
(
int
mode
);
void
resizedMagnifier
(
qreal
newPercent
);
bool
hasGroups
()
{
return
mNumberOfGroups
!=
0
;
}
protected
:
...
...
@@ -434,7 +433,6 @@ public slots:
bool
mDrawWithCompass
;
UBGraphicsPolygonItem
*
mCurrentPolygon
;
UBSelectionFrame
*
mSelectionFrame
;
int
mNumberOfGroups
;
};
...
...
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