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
c4cefa67
Commit
c4cefa67
authored
Dec 14, 2011
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SANKORE-300 / SANKORE-332 : fix clear item when we add new page, and this item not in scene
parent
d15e23d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
1 deletion
+50
-1
UBBoardController.cpp
src/board/UBBoardController.cpp
+44
-1
UBBoardController.h
src/board/UBBoardController.h
+3
-0
UBGraphicsItemUndoCommand.h
src/domain/UBGraphicsItemUndoCommand.h
+3
-0
No files found.
src/board/UBBoardController.cpp
View file @
c4cefa67
...
...
@@ -1132,7 +1132,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
if
(
sceneChange
)
emit
activeSceneWillChange
();
UBApplication
::
undoStack
->
clear
();
ClearUndoStack
();
mActiveScene
=
targetScene
;
mActiveDocument
=
pDocumentProxy
;
...
...
@@ -1173,6 +1173,49 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
}
}
void
UBBoardController
::
ClearUndoStack
()
{
QSet
<
QGraphicsItem
*>
uniqueItems
;
QUndoStack
*
stack
=
UBApplication
::
undoStack
;
// go through all stack command
for
(
int
i
=
0
;
i
<
stack
->
count
();
i
++
)
{
UBGraphicsItemUndoCommand
*
cmd
=
(
UBGraphicsItemUndoCommand
*
)
stack
->
command
(
i
);
// go through all added and removed objects, for create list of unique objects
QSetIterator
<
QGraphicsItem
*>
itAdded
(
cmd
->
GetAddedList
());
while
(
itAdded
.
hasNext
())
{
QGraphicsItem
*
item
=
itAdded
.
next
();
if
(
!
uniqueItems
.
contains
(
item
)
)
uniqueItems
.
insert
(
item
);
}
QSetIterator
<
QGraphicsItem
*>
itRemoved
(
cmd
->
GetRemovedList
());
while
(
itRemoved
.
hasNext
())
{
QGraphicsItem
*
item
=
itRemoved
.
next
();
if
(
!
uniqueItems
.
contains
(
item
)
)
uniqueItems
.
insert
(
item
);
}
}
// clear stack, and command list
stack
->
clear
();
// go through all unique items, and check, ot on scene, or not.
// if not on scene, than item can be deleted
QSetIterator
<
QGraphicsItem
*>
itUniq
(
uniqueItems
);
while
(
itUniq
.
hasNext
())
{
QGraphicsItem
*
item
=
itUniq
.
next
();
UBGraphicsScene
*
scene
=
(
UBGraphicsScene
*
)
item
->
scene
();
if
(
!
scene
)
delete
item
;
}
}
void
UBBoardController
::
adjustDisplayViews
()
{
...
...
src/board/UBBoardController.h
View file @
c4cefa67
...
...
@@ -150,6 +150,9 @@ class UBBoardController : public QObject
void
notifyPageChanged
();
void
displayMetaData
(
QMap
<
QString
,
QString
>
metadatas
);
void
ClearUndoStack
();
public
slots
:
void
setActiveDocumentScene
(
UBDocumentProxy
*
pDocumentProxy
,
int
pSceneIndex
=
0
);
void
showDocumentsDialog
();
...
...
src/domain/UBGraphicsItemUndoCommand.h
View file @
c4cefa67
...
...
@@ -32,6 +32,9 @@ class UBGraphicsItemUndoCommand : public QUndoCommand
virtual
~
UBGraphicsItemUndoCommand
();
QSet
<
QGraphicsItem
*>
GetAddedList
()
{
return
mAddedItems
;
};
QSet
<
QGraphicsItem
*>
GetRemovedList
()
{
return
mRemovedItems
;
};
protected
:
virtual
void
undo
();
virtual
void
redo
();
...
...
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