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
73d7cc88
Commit
73d7cc88
authored
Jun 19, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mouse events adjusted to 1.50 specification.
parent
714e1855
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
32 deletions
+66
-32
UBBoardView.cpp
src/board/UBBoardView.cpp
+64
-30
UBBoardView.h
src/board/UBBoardView.h
+2
-2
No files found.
src/board/UBBoardView.cpp
View file @
73d7cc88
...
...
@@ -375,21 +375,6 @@ void UBBoardView::tabletEvent (QTabletEvent * event)
}
bool
UBBoardView
::
hasToolBarAsParent
(
QGraphicsItem
*
item
)
{
if
(
!
item
)
return
false
;
if
(
!
item
->
parentItem
())
return
hasToolBarAsParent
(
0
);
if
(
UBGraphicsToolBarItem
::
Type
==
item
->
parentItem
()
->
type
())
return
true
;
else
return
hasToolBarAsParent
(
item
->
parentItem
());
}
bool
UBBoardView
::
itemIsLocked
(
QGraphicsItem
*
item
)
{
if
(
!
item
)
...
...
@@ -402,7 +387,7 @@ bool UBBoardView::itemIsLocked(QGraphicsItem *item)
}
bool
UBBoardView
::
itemHaveType
(
QGraphicsItem
*
item
,
int
type
)
bool
UBBoardView
::
itemHave
ParentWith
Type
(
QGraphicsItem
*
item
,
int
type
)
{
if
(
!
item
)
return
false
;
...
...
@@ -410,10 +395,24 @@ bool UBBoardView::itemHaveType(QGraphicsItem *item, int type)
if
(
type
==
item
->
type
())
return
true
;
return
itemHaveType
(
item
->
parentItem
(),
type
);
return
itemHave
ParentWith
Type
(
item
->
parentItem
(),
type
);
}
QGraphicsItem
*
UBBoardView
::
determinedItemToMove
()
{
// groupConteinerItem should be moved instead of it's owned items
if
(
movingItem
&&
movingItem
->
parentItem
()
&&
(
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
parentItem
()
->
type
()
||
UBGraphicsStrokesGroup
::
Type
==
movingItem
->
parentItem
()
->
type
()
)
)
{
movingItem
=
movingItem
->
parentItem
();
}
return
movingItem
;
}
void
UBBoardView
::
mousePressEvent
(
QMouseEvent
*
event
)
{
if
(
isAbsurdPoint
(
event
->
pos
()))
...
...
@@ -477,8 +476,8 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
||
movingItem
==
this
->
scene
()
->
backgroundObject
()
||
(
movingItem
->
parentItem
()
&&
movingItem
->
parentItem
()
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
))
{
if
(
!
itemIsLocked
(
movingItem
)
||
itemHaveType
(
movingItem
,
UBGraphicsMediaItem
::
Type
))
if
(
movingItem
&&
!
itemIsLocked
(
movingItem
)
||
itemHave
ParentWith
Type
(
movingItem
,
UBGraphicsMediaItem
::
Type
))
{
QGraphicsView
::
mousePressEvent
(
event
);
...
...
@@ -499,25 +498,41 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
}
else
if
(
currentTool
==
UBStylusTool
::
Play
)
{
movingItem
=
scene
()
->
itemAt
(
this
->
mapToScene
(
event
->
posF
().
toPoint
()));
mLastPressedMousePos
=
mapToScene
(
event
->
pos
());
if
(
movingItem
&&
(
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
type
()
||
UBGraphicsMediaItem
::
Type
=
=
movingItem
->
type
()
||
hasToolBarAsParent
(
movingItem
))
)
// items, who shouldn't receive mouse press event
if
(
movingItem
&&
UBGraphicsTextItem
::
Type
!
=
movingItem
->
type
()
)
{
movingItem
=
NULL
;
QGraphicsView
::
mousePressEvent
(
event
);
return
;
QGraphicsView
::
mousePressEvent
(
event
);
}
if
(
movingItem
&&
movingItem
->
parentItem
()
&&
movingItem
->
parentItem
()
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
)
// items, who should receive suspended mouse press event
if
(
movingItem
&&
UBGraphicsMediaItem
::
Type
==
movingItem
->
type
()
)
{
if
(
suspendedMousePressEvent
)
{
delete
suspendedMousePressEvent
;
}
suspendedMousePressEvent
=
new
QMouseEvent
(
event
->
type
(),
event
->
pos
(),
event
->
button
(),
event
->
buttons
(),
event
->
modifiers
());
// удалить
}
// groups shouldn't be moved independant of items)
if
(
movingItem
&&
(
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
type
()
||
UBGraphicsStrokesGroup
::
Type
==
movingItem
->
type
()
)
)
{
movingItem
=
movingItem
->
parentItem
();
}
movingItem
=
NULL
;
}
movingItem
=
determinedItemToMove
();
event
->
accept
();
}
...
...
@@ -653,6 +668,17 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
}
else
if
(
currentTool
==
UBStylusTool
::
Play
)
{
// items, who shouldn't receive mouse move events
if
(
movingItem
&&
(
UBGraphicsW3CWidgetItem
::
Type
==
movingItem
->
type
()
||
itemHaveParentWithType
(
movingItem
,
UBGraphicsToolBarItem
::
Type
)
)
)
{
movingItem
=
NULL
;
}
if
(
movingItem
&&
(
mMouseButtonIsPressed
||
mTabletStylusIsPressed
)
&&
!
movingItem
->
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
())
{
...
...
@@ -734,6 +760,14 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
else
if
(
currentTool
==
UBStylusTool
::
Play
)
{
if
(
suspendedMousePressEvent
&&
!
movingItem
->
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
())
{
QGraphicsView
::
mousePressEvent
(
suspendedMousePressEvent
);
// suspendedMousePressEvent is deleted by old Qt event loop
movingItem
=
NULL
;
delete
suspendedMousePressEvent
;
suspendedMousePressEvent
=
NULL
;
}
QGraphicsView
::
mouseReleaseEvent
(
event
);
}
else
if
(
currentTool
==
UBStylusTool
::
Text
)
...
...
src/board/UBBoardView.h
View file @
73d7cc88
...
...
@@ -51,9 +51,9 @@ class UBBoardView : public QGraphicsView
protected
:
bool
hasToolBarAsParent
(
QGraphicsItem
*
item
);
bool
itemIsLocked
(
QGraphicsItem
*
item
);
bool
itemHaveType
(
QGraphicsItem
*
item
,
int
type
);
bool
itemHaveParentWithType
(
QGraphicsItem
*
item
,
int
type
);
QGraphicsItem
*
determinedItemToMove
();
virtual
bool
event
(
QEvent
*
e
);
...
...
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