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
ff90ddf3
Commit
ff90ddf3
authored
Mar 12, 2012
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SANKORE-78
parent
bff3e834
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1133 additions
and
1073 deletions
+1133
-1073
UBBoardView.cpp
src/board/UBBoardView.cpp
+998
-944
UBBoardView.h
src/board/UBBoardView.h
+135
-129
No files found.
src/board/UBBoardView.cpp
View file @
ff90ddf3
...
...
@@ -58,6 +58,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent)
,
mIsCreatingTextZone
(
false
)
,
mIsCreatingSceneGrabZone
(
false
)
,
mOkOnWidget
(
false
)
,
suspendedMousePressEvent
(
NULL
)
{
init
();
...
...
@@ -67,6 +68,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent)
UBBoardView
::
UBBoardView
(
UBBoardController
*
pController
,
int
pStartLayer
,
int
pEndLayer
,
QWidget
*
pParent
)
:
QGraphicsView
(
pParent
)
,
mController
(
pController
)
,
suspendedMousePressEvent
(
NULL
)
{
init
();
...
...
@@ -78,6 +80,8 @@ UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int p
UBBoardView
::~
UBBoardView
()
{
//NOOP
if
(
suspendedMousePressEvent
)
delete
suspendedMousePressEvent
;
}
void
...
...
@@ -116,6 +120,9 @@ UBBoardView::init ()
settingChanged
(
QVariant
());
unsetCursor
();
movingItem
=
NULL
;
mWidgetMoved
=
false
;
}
UBGraphicsScene
*
...
...
@@ -410,7 +417,28 @@ UBBoardView::mousePressEvent (QMouseEvent *event)
}
else
if
(
currentTool
==
UBStylusTool
::
Selector
)
{
movingItem
=
scene
()
->
itemAt
(
this
->
mapToScene
(
event
->
posF
().
toPoint
()));
if
(
!
movingItem
||
movingItem
->
isSelected
()
||
(
movingItem
->
type
()
==
UBGraphicsDelegateFrame
::
Type
||
movingItem
->
type
()
==
DelegateButton
::
Type
))
{
movingItem
=
NULL
;
QGraphicsView
::
mousePressEvent
(
event
);
}
else
{
mLastPressedMousePos
=
mapToScene
(
event
->
pos
());
if
(
suspendedMousePressEvent
)
{
delete
suspendedMousePressEvent
;
}
suspendedMousePressEvent
=
new
QMouseEvent
(
event
->
type
(),
event
->
pos
(),
event
->
button
(),
event
->
buttons
(),
event
->
modifiers
());
//
}
event
->
accept
();
}
else
if
(
currentTool
==
UBStylusTool
::
Text
)
{
...
...
@@ -496,7 +524,20 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
}
else
if
(
currentTool
==
UBStylusTool
::
Selector
)
{
QGraphicsView
::
mouseMoveEvent
(
event
);
if
((
event
->
pos
()
-
mLastPressedMousePos
).
manhattanLength
()
<
QApplication
::
startDragDistance
())
{
return
;
}
if
(
movingItem
&&
(
mMouseButtonIsPressed
||
mTabletStylusIsPressed
))
{
QPointF
scenePos
=
mapToScene
(
event
->
pos
());
QPointF
newPos
=
movingItem
->
pos
()
+
scenePos
-
mLastPressedMousePos
;
movingItem
->
setPos
(
newPos
);
mLastPressedMousePos
=
scenePos
;
mWidgetMoved
=
true
;
event
->
accept
();
}
else
QGraphicsView
::
mouseMoveEvent
(
event
);
}
else
if
((
UBDrawingController
::
drawingController
()
->
isDrawingTool
())
&&
!
mMouseButtonIsPressed
)
...
...
@@ -539,6 +580,19 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if
(
currentTool
==
UBStylusTool
::
Selector
)
{
if
(
mWidgetMoved
)
{
mWidgetMoved
=
false
;
movingItem
=
NULL
;
}
else
if
(
movingItem
&&
suspendedMousePressEvent
)
{
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 @
ff90ddf3
...
...
@@ -18,6 +18,7 @@
#include <QtGui>
#include "core/UB.h"
#include "domain/UBGraphicsDelegateFrame.h"
class
UBBoardController
;
class
UBAppleWidget
;
...
...
@@ -116,6 +117,11 @@ class UBBoardView : public QGraphicsView
bool
mVirtualKeyboardActive
;
bool
mOkOnWidget
;
bool
mWidgetMoved
;
QPointF
mLastPressedMousePos
;
QGraphicsItem
*
movingItem
;
QMouseEvent
*
suspendedMousePressEvent
;
private
slots
:
void
settingChanged
(
QVariant
newValue
);
...
...
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