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
61c63195
Commit
61c63195
authored
Aug 27, 2012
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sankore-1001 Background never get object zlayer anymore. BordView dropEvent fix
parent
4772233b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
61 deletions
+74
-61
UBBoardView.cpp
src/board/UBBoardView.cpp
+65
-59
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+8
-2
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+1
-0
No files found.
src/board/UBBoardView.cpp
View file @
61c63195
...
@@ -443,23 +443,23 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item)
...
@@ -443,23 +443,23 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item)
//
//
// item selection managed by QGraphicsView::mousePressEvent(). It should be called later.
// item selection managed by QGraphicsView::mousePressEvent(). It should be called later.
if
(
item
)
if
(
item
)
{
{
// item has group as first parent - it is any item or UBGraphicsStrokesGroup.
// item has group as first parent - it is any item or UBGraphicsStrokesGroup.
if
(
item
->
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
parentItem
()
->
type
())
if
(
item
->
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
parentItem
()
->
type
())
return
;
return
;
// delegate buttons shouldn't selected
// delegate buttons shouldn't selected
if
(
DelegateButton
::
Type
==
item
->
type
())
if
(
DelegateButton
::
Type
==
item
->
type
())
return
;
return
;
// click on svg items (images on Frame) shouldn't change selection.
// click on svg items (images on Frame) shouldn't change selection.
if
(
QGraphicsSvgItem
::
Type
==
item
->
type
())
if
(
QGraphicsSvgItem
::
Type
==
item
->
type
())
return
;
return
;
// Delegate frame shouldn't selected
// Delegate frame shouldn't selected
if
(
UBGraphicsDelegateFrame
::
Type
==
item
->
type
())
if
(
UBGraphicsDelegateFrame
::
Type
==
item
->
type
())
return
;
return
;
// if we need to uwe multiple selection - we shouldn't deselect other items.
// if we need to uwe multiple selection - we shouldn't deselect other items.
...
@@ -591,9 +591,9 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
...
@@ -591,9 +591,9 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
if
(
movingItem
->
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
())
if
(
movingItem
->
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
())
return
false
;
return
false
;
if
(
movingItem
->
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
parentItem
()
->
type
()
&&
!
movingItem
->
isSelected
()
&&
movingItem
->
parentItem
()
->
isSelected
())
if
(
movingItem
->
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
parentItem
()
->
type
()
&&
!
movingItem
->
isSelected
()
&&
movingItem
->
parentItem
()
->
isSelected
())
return
false
;
return
false
;
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
switch
(
item
->
type
())
switch
(
item
->
type
())
...
@@ -617,7 +617,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
...
@@ -617,7 +617,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
case
UBGraphicsTextItem
:
:
Type
:
case
UBGraphicsTextItem
:
:
Type
:
return
!
item
->
isSelected
();
return
!
item
->
isSelected
();
}
}
return
false
;
return
false
;
}
}
...
@@ -625,9 +625,9 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
...
@@ -625,9 +625,9 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
QGraphicsItem
*
UBBoardView
::
determineItemToPress
(
QGraphicsItem
*
item
)
QGraphicsItem
*
UBBoardView
::
determineItemToPress
(
QGraphicsItem
*
item
)
{
{
if
(
item
)
if
(
item
)
{
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
// groups should should be moved instead of strokes groups
// groups should should be moved instead of strokes groups
if
(
item
->
parentItem
()
&&
UBGraphicsStrokesGroup
::
Type
==
item
->
type
())
if
(
item
->
parentItem
()
&&
UBGraphicsStrokesGroup
::
Type
==
item
->
type
())
return
item
->
parentItem
();
return
item
->
parentItem
();
...
@@ -639,7 +639,7 @@ QGraphicsItem* UBBoardView::determineItemToPress(QGraphicsItem *item)
...
@@ -639,7 +639,7 @@ QGraphicsItem* UBBoardView::determineItemToPress(QGraphicsItem *item)
&&
!
item
->
parentItem
()
->
isSelected
())
&&
!
item
->
parentItem
()
->
isSelected
())
return
item
->
parentItem
();
return
item
->
parentItem
();
// items like polygons placed in two groups nested, so we need to recursive call.
// items like polygons placed in two groups nested, so we need to recursive call.
if
(
item
->
parentItem
()
&&
UBGraphicsStrokesGroup
::
Type
==
item
->
parentItem
()
->
type
())
if
(
item
->
parentItem
()
&&
UBGraphicsStrokesGroup
::
Type
==
item
->
parentItem
()
->
type
())
return
determineItemToPress
(
item
->
parentItem
());
return
determineItemToPress
(
item
->
parentItem
());
}
}
...
@@ -653,33 +653,33 @@ QGraphicsItem* UBBoardView::determineItemToMove(QGraphicsItem *item)
...
@@ -653,33 +653,33 @@ QGraphicsItem* UBBoardView::determineItemToMove(QGraphicsItem *item)
if
(
item
)
if
(
item
)
{
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
//W3C widgets should take mouse move events from play tool.
//W3C widgets should take mouse move events from play tool.
if
((
UBStylusTool
::
Play
==
currentTool
)
&&
(
UBGraphicsW3CWidgetItem
::
Type
==
item
->
type
()))
if
((
UBStylusTool
::
Play
==
currentTool
)
&&
(
UBGraphicsW3CWidgetItem
::
Type
==
item
->
type
()))
return
item
;
return
item
;
// if item is in group
// if item is in group
if
(
item
->
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
item
->
parentItem
()
->
type
())
if
(
item
->
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
item
->
parentItem
()
->
type
())
{
{
// play tool should move groups by any element
// play tool should move groups by any element
if
(
UBStylusTool
::
Play
==
currentTool
&&
item
->
parentItem
()
->
isSelected
())
if
(
UBStylusTool
::
Play
==
currentTool
&&
item
->
parentItem
()
->
isSelected
())
return
item
->
parentItem
();
return
item
->
parentItem
();
// groups should should be moved instead of strokes groups
// groups should should be moved instead of strokes groups
if
(
UBGraphicsStrokesGroup
::
Type
==
item
->
type
())
if
(
UBGraphicsStrokesGroup
::
Type
==
item
->
type
())
return
item
->
parentItem
();
return
item
->
parentItem
();
// selected groups should be moved by moving any element
// selected groups should be moved by moving any element
if
(
item
->
parentItem
()
->
isSelected
())
if
(
item
->
parentItem
()
->
isSelected
())
return
item
;
return
item
;
if
(
item
->
isSelected
())
if
(
item
->
isSelected
())
return
NULL
;
return
NULL
;
return
item
->
parentItem
();
return
item
->
parentItem
();
}
}
// items like polygons placed in two groups nested, so we need to recursive call.
// items like polygons placed in two groups nested, so we need to recursive call.
if
(
item
->
parentItem
()
&&
UBGraphicsStrokesGroup
::
Type
==
item
->
parentItem
()
->
type
())
if
(
item
->
parentItem
()
&&
UBGraphicsStrokesGroup
::
Type
==
item
->
parentItem
()
->
type
())
return
determineItemToMove
(
item
->
parentItem
());
return
determineItemToMove
(
item
->
parentItem
());
}
}
...
@@ -724,10 +724,10 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
...
@@ -724,10 +724,10 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
void
UBBoardView
::
handleItemMouseMove
(
QMouseEvent
*
event
)
void
UBBoardView
::
handleItemMouseMove
(
QMouseEvent
*
event
)
{
{
// determine item to move (maybee we need to move group of item or his parent.
// determine item to move (maybee we need to move group of item or his parent.
movingItem
=
determineItemToMove
(
movingItem
);
movingItem
=
determineItemToMove
(
movingItem
);
// items should be moved not every mouse move.
// items should be moved not every mouse move.
if
(
movingItem
&&
itemShouldBeMoved
(
movingItem
)
&&
(
mMouseButtonIsPressed
||
mTabletStylusIsPressed
))
if
(
movingItem
&&
itemShouldBeMoved
(
movingItem
)
&&
(
mMouseButtonIsPressed
||
mTabletStylusIsPressed
))
{
{
QPointF
scenePos
=
mapToScene
(
event
->
pos
());
QPointF
scenePos
=
mapToScene
(
event
->
pos
());
...
@@ -753,8 +753,8 @@ void UBBoardView::handleItemMouseMove(QMouseEvent *event)
...
@@ -753,8 +753,8 @@ void UBBoardView::handleItemMouseMove(QMouseEvent *event)
mWidgetMoved
=
((
posAfterMove
-
posBeforeMove
).
manhattanLength
()
!=
0
);
mWidgetMoved
=
((
posAfterMove
-
posBeforeMove
).
manhattanLength
()
!=
0
);
// a cludge for terminate moving of w3c widgets.
// a cludge for terminate moving of w3c widgets.
// in some cases w3c widgets catches mouse move and doesn't sends that events to web page,
// in some cases w3c widgets catches mouse move and doesn't sends that events to web page,
// at simple - in google map widget - mouse move events doesn't comes to web page from rectangle of wearch bar on bottom right corner of widget.
// at simple - in google map widget - mouse move events doesn't comes to web page from rectangle of wearch bar on bottom right corner of widget.
if
(
mWidgetMoved
&&
UBGraphicsW3CWidgetItem
::
Type
==
movingItem
->
type
())
if
(
mWidgetMoved
&&
UBGraphicsW3CWidgetItem
::
Type
==
movingItem
->
type
())
movingItem
->
setPos
(
posBeforeMove
);
movingItem
->
setPos
(
posBeforeMove
);
...
@@ -1093,9 +1093,9 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
...
@@ -1093,9 +1093,9 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{
{
if
(
QGraphicsSvgItem
::
Type
!=
movingItem
->
type
()
&&
if
(
QGraphicsSvgItem
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsDelegateFrame
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsDelegateFrame
::
Type
!=
movingItem
->
type
()
&&
UBToolWidget
::
Type
!=
movingItem
->
type
()
&&
UBToolWidget
::
Type
!=
movingItem
->
type
()
&&
QGraphicsWebView
::
Type
!=
movingItem
->
type
()
&&
// for W3C widgets as Tools.
QGraphicsWebView
::
Type
!=
movingItem
->
type
()
&&
// for W3C widgets as Tools.
!
(
!
isMultipleSelectionEnabled
()
&&
movingItem
->
parentItem
()
&&
UBGraphicsWidgetItem
::
Type
==
movingItem
->
type
()
&&
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
parentItem
()
->
type
()))
!
(
!
isMultipleSelectionEnabled
()
&&
movingItem
->
parentItem
()
&&
UBGraphicsWidgetItem
::
Type
==
movingItem
->
type
()
&&
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
parentItem
()
->
type
()))
{
{
bReleaseIsNeed
=
false
;
bReleaseIsNeed
=
false
;
if
(
movingItem
->
isSelected
()
&&
isMultipleSelectionEnabled
())
if
(
movingItem
->
isSelected
()
&&
isMultipleSelectionEnabled
())
...
@@ -1319,14 +1319,20 @@ void UBBoardView::dragMoveEvent(QDragMoveEvent *event)
...
@@ -1319,14 +1319,20 @@ void UBBoardView::dragMoveEvent(QDragMoveEvent *event)
void
UBBoardView
::
dropEvent
(
QDropEvent
*
event
)
void
UBBoardView
::
dropEvent
(
QDropEvent
*
event
)
{
{
if
(
!
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
()))
{
QGraphicsItem
*
onItem
=
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UBTGMediaWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QListView
*>
(
event
->
source
())
||
dynamic_cast
<
UBTGDraggableTreeItem
*>
(
event
->
source
()))
{
if
(
onItem
&&
onItem
->
type
()
==
UBGraphicsWidgetItem
::
Type
)
{
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
QGraphicsView
::
dropEvent
(
event
);
event
->
acceptProposedAction
();
}
else
{
if
(
!
event
->
source
()
||
qobject_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
qobject_cast
<
QWebView
*>
(
event
->
source
())
||
qobject_cast
<
UBTGMediaWidget
*>
(
event
->
source
())
||
qobject_cast
<
QListView
*>
(
event
->
source
())
||
qobject_cast
<
UBTGDraggableTreeItem
*>
(
event
->
source
()))
{
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
event
->
acceptProposedAction
();
}
}
}
}
else
QGraphicsView
::
dropEvent
(
event
);
}
}
void
void
...
@@ -1515,11 +1521,11 @@ UBBoardView::setToolCursor (int tool)
...
@@ -1515,11 +1521,11 @@ UBBoardView::setToolCursor (int tool)
}
}
bool
UBBoardView
::
hasSelectedParents
(
QGraphicsItem
*
item
)
bool
UBBoardView
::
hasSelectedParents
(
QGraphicsItem
*
item
)
{
{
if
(
item
->
isSelected
())
if
(
item
->
isSelected
())
return
true
;
return
true
;
if
(
item
->
parentItem
()
==
NULL
)
if
(
item
->
parentItem
()
==
NULL
)
return
false
;
return
false
;
return
hasSelectedParents
(
item
->
parentItem
());
return
hasSelectedParents
(
item
->
parentItem
());
}
}
src/domain/UBGraphicsScene.cpp
View file @
61c63195
...
@@ -249,6 +249,11 @@ itemLayerType::Enum UBZLayerController::typeForData(QGraphicsItem *item) const
...
@@ -249,6 +249,11 @@ itemLayerType::Enum UBZLayerController::typeForData(QGraphicsItem *item) const
return
result
;
return
result
;
}
}
void
UBZLayerController
::
setLayerType
(
QGraphicsItem
*
pItem
,
itemLayerType
::
Enum
pNewType
)
{
pItem
->
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
pNewType
));
}
UBGraphicsScene
::
UBGraphicsScene
(
UBDocumentProxy
*
parent
)
UBGraphicsScene
::
UBGraphicsScene
(
UBDocumentProxy
*
parent
)
:
UBCoreGraphicsScene
(
parent
)
:
UBCoreGraphicsScene
(
parent
)
,
mEraser
(
0
)
,
mEraser
(
0
)
...
@@ -1637,8 +1642,6 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
...
@@ -1637,8 +1642,6 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
item
->
setAcceptedMouseButtons
(
Qt
::
NoButton
);
item
->
setAcceptedMouseButtons
(
Qt
::
NoButton
);
item
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
FixedBackground
);
item
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
FixedBackground
);
UBGraphicsItem
::
assignZValue
(
item
,
mZLayerController
->
generateZLevel
(
itemLayerType
::
BackgroundItem
));
if
(
pAdaptTransformation
)
if
(
pAdaptTransformation
)
{
{
item
=
scaleToFitDocumentSize
(
item
,
true
,
0
,
pExpand
);
item
=
scaleToFitDocumentSize
(
item
,
true
,
0
,
pExpand
);
...
@@ -1647,6 +1650,9 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
...
@@ -1647,6 +1650,9 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
if
(
item
->
scene
()
!=
this
)
if
(
item
->
scene
()
!=
this
)
addItem
(
item
);
addItem
(
item
);
mZLayerController
->
setLayerType
(
item
,
itemLayerType
::
BackgroundItem
);
UBGraphicsItem
::
assignZValue
(
item
,
mZLayerController
->
generateZLevel
(
item
));
mBackgroundObject
=
item
;
mBackgroundObject
=
item
;
}
}
...
...
src/domain/UBGraphicsScene.h
View file @
61c63195
...
@@ -87,6 +87,7 @@ public:
...
@@ -87,6 +87,7 @@ public:
qreal
changeZLevelTo
(
QGraphicsItem
*
item
,
moveDestination
dest
);
qreal
changeZLevelTo
(
QGraphicsItem
*
item
,
moveDestination
dest
);
itemLayerType
::
Enum
typeForData
(
QGraphicsItem
*
item
)
const
;
itemLayerType
::
Enum
typeForData
(
QGraphicsItem
*
item
)
const
;
void
setLayerType
(
QGraphicsItem
*
pItem
,
itemLayerType
::
Enum
pNewType
);
private
:
private
:
ScopeMap
scopeMap
;
ScopeMap
scopeMap
;
...
...
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