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
6d735044
Commit
6d735044
authored
Apr 25, 2014
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
workaround for issue related to the group duplication
parent
1e6e64c9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
25 deletions
+16
-25
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+0
-10
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+2
-2
UBGraphicsGroupContainerItem.cpp
src/domain/UBGraphicsGroupContainerItem.cpp
+2
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+9
-12
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+3
-0
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
6d735044
...
...
@@ -1066,16 +1066,6 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
// Get the items from the scene
QList
<
QGraphicsItem
*>
items
=
mScene
->
items
();
// int strokes = 0; int polygons = 0;
// foreach(QGraphicsItem *item, items) {
// if (item->type() == UBGraphicsPolygonItem::Type) {
// polygons++;
// } else if (item->type() == UBGraphicsStrokesGroup::Type) {
// strokes++;
// }
// }
// qDebug() << "---Strokes count" << strokes << "Polygons count" << polygons;
// qDebug() << "---Number of scene items " << items.count();
qSort
(
items
.
begin
(),
items
.
end
(),
itemZIndexComp
);
UBGraphicsStroke
*
openStroke
=
0
;
...
...
src/core/UBPersistenceManager.cpp
View file @
6d735044
...
...
@@ -757,15 +757,15 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
if
(
pScene
->
isModified
())
{
UBThumbnailAdaptor
::
persistScene
(
pDocumentProxy
,
pScene
,
pSceneIndex
);
if
(
forceImmediateSaving
)
if
(
forceImmediateSaving
||
pScene
->
hasGroups
()
)
UBSvgSubsetAdaptor
::
persistScene
(
pDocumentProxy
,
pScene
,
pSceneIndex
);
else
{
UBGraphicsScene
*
copiedScene
=
pScene
->
sceneDeepCopy
();
mWorker
->
saveScene
(
pDocumentProxy
,
copiedScene
,
pSceneIndex
);
pScene
->
setModified
(
false
);
}
}
}
...
...
src/domain/UBGraphicsGroupContainerItem.cpp
View file @
6d735044
...
...
@@ -188,10 +188,11 @@ UBCoreGraphicsScene *UBGraphicsGroupContainerItem::corescene()
return
castScene
;
}
UBGraphicsGroupContainerItem
*
UBGraphicsGroupContainerItem
::
deepCopy
()
const
{
UBGraphicsGroupContainerItem
*
copy
=
new
UBGraphicsGroupContainerItem
(
parentItem
()
);
UBGraphicsGroupContainerItem
*
copy
=
new
UBGraphicsGroupContainerItem
();
copy
->
setUuid
(
this
->
uuid
());
// this is OK for now as long as Widgets are imutable
...
...
src/domain/UBGraphicsScene.cpp
View file @
6d735044
...
...
@@ -315,6 +315,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
,
mpLastPolygon
(
NULL
)
,
mCurrentPolygon
(
0
)
,
mSelectionFrame
(
0
)
,
mNumberOfGroups
(
0
)
{
UBCoreGraphicsScene
::
setObjectName
(
"BoardScene"
);
setItemIndexMethod
(
NoIndex
);
...
...
@@ -1101,30 +1102,19 @@ UBGraphicsScene* UBGraphicsScene::sceneDeepCopy() const
copy
->
setNominalSize
(
this
->
mNominalSize
);
QListIterator
<
QGraphicsItem
*>
itItems
(
this
->
mFastAccessItems
);
QMap
<
UBGraphicsStroke
*
,
UBGraphicsStroke
*>
groupClone
;
QList
<
QUuid
>
groupAlreadyCloned
;
while
(
itItems
.
hasNext
())
{
QGraphicsItem
*
item
=
itItems
.
next
();
QGraphicsItem
*
cloneItem
=
0
;
UBItem
*
ubItem
=
dynamic_cast
<
UBItem
*>
(
item
);
UBGraphicsStroke
*
stroke
=
dynamic_cast
<
UBGraphicsStroke
*>
(
item
);
UBGraphicsGroupContainerItem
*
group
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
item
);
if
(
ubItem
&&
!
stroke
)
{
//horrible hack
if
(
group
&&
!
groupAlreadyCloned
.
contains
(
group
->
uuid
())){
cloneItem
=
dynamic_cast
<
QGraphicsItem
*>
(
ubItem
->
deepCopy
());
groupAlreadyCloned
.
append
(
group
->
uuid
());
}
if
(
!
group
)
cloneItem
=
dynamic_cast
<
QGraphicsItem
*>
(
ubItem
->
deepCopy
());
cloneItem
=
dynamic_cast
<
QGraphicsItem
*>
(
ubItem
->
deepCopy
());
}
if
(
cloneItem
)
...
...
@@ -1629,6 +1619,8 @@ 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
()){
...
...
@@ -1658,6 +1650,9 @@ 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
);
...
...
@@ -1674,6 +1669,8 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
void
UBGraphicsScene
::
removeItems
(
const
QSet
<
QGraphicsItem
*>&
items
)
{
foreach
(
QGraphicsItem
*
item
,
items
)
{
if
(
item
->
type
()
==
UBGraphicsItemType
::
groupContainerType
)
mNumberOfGroups
-=
1
;
UBCoreGraphicsScene
::
removeItem
(
item
);
}
...
...
src/domain/UBGraphicsScene.h
View file @
6d735044
...
...
@@ -348,6 +348,7 @@ public slots:
void
zoomOutMagnifier
();
void
changeMagnifierMode
(
int
mode
);
void
resizedMagnifier
(
qreal
newPercent
);
bool
hasGroups
()
{
return
mNumberOfGroups
!=
0
;
}
protected
:
...
...
@@ -374,6 +375,7 @@ public slots:
virtual
void
drawBackground
(
QPainter
*
painter
,
const
QRectF
&
rect
);
private
:
void
setDocumentUpdated
();
void
createEraiser
();
...
...
@@ -432,6 +434,7 @@ 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