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
3fac754e
Commit
3fac754e
authored
Jun 22, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Long press implemented.
PlayTool -> SelectTool SelectTool -> PlayTool EraiserTool -> shows EraserPalette.
parent
de18bf79
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
7 deletions
+74
-7
UBBoardPaletteManager.h
src/board/UBBoardPaletteManager.h
+2
-1
UBBoardView.cpp
src/board/UBBoardView.cpp
+66
-6
UBBoardView.h
src/board/UBBoardView.h
+6
-0
No files found.
src/board/UBBoardPaletteManager.h
View file @
3fac754e
...
@@ -89,6 +89,8 @@ class UBBoardPaletteManager : public QObject
...
@@ -89,6 +89,8 @@ class UBBoardPaletteManager : public QObject
void
slot_changeMainMode
(
UBApplicationController
::
MainMode
);
void
slot_changeMainMode
(
UBApplicationController
::
MainMode
);
void
slot_changeDesktopMode
(
bool
);
void
slot_changeDesktopMode
(
bool
);
void
toggleErasePalette
(
bool
ckecked
);
private
:
private
:
void
setupPalettes
();
void
setupPalettes
();
...
@@ -168,7 +170,6 @@ class UBBoardPaletteManager : public QObject
...
@@ -168,7 +170,6 @@ class UBBoardPaletteManager : public QObject
void
erasePaletteButtonPressed
();
void
erasePaletteButtonPressed
();
void
erasePaletteButtonReleased
();
void
erasePaletteButtonReleased
();
void
toggleErasePalette
(
bool
ckecked
);
void
erasePaletteClosed
();
void
erasePaletteClosed
();
void
togglePagePalette
(
bool
ckecked
);
void
togglePagePalette
(
bool
ckecked
);
...
...
src/board/UBBoardView.cpp
View file @
3fac754e
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include "gui/UBTeacherGuideWidgetsTools.h"
#include "gui/UBTeacherGuideWidgetsTools.h"
#include "board/UBBoardController.h"
#include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h"
#include "domain/UBGraphicsTextItem.h"
#include "domain/UBGraphicsTextItem.h"
#include "domain/UBGraphicsPixmapItem.h"
#include "domain/UBGraphicsPixmapItem.h"
...
@@ -68,23 +69,33 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent)
...
@@ -68,23 +69,33 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent)
,
mIsCreatingSceneGrabZone
(
false
)
,
mIsCreatingSceneGrabZone
(
false
)
,
mOkOnWidget
(
false
)
,
mOkOnWidget
(
false
)
,
suspendedMousePressEvent
(
NULL
)
,
suspendedMousePressEvent
(
NULL
)
,
mLongPressInterval
(
1000
)
,
mIsDragInProgress
(
false
)
{
{
init
();
init
();
mFilterZIndex
=
false
;
mFilterZIndex
=
false
;
mLongPressTimer
.
setInterval
(
mLongPressInterval
);
mLongPressTimer
.
setSingleShot
(
true
);
}
}
UBBoardView
::
UBBoardView
(
UBBoardController
*
pController
,
int
pStartLayer
,
int
pEndLayer
,
QWidget
*
pParent
)
UBBoardView
::
UBBoardView
(
UBBoardController
*
pController
,
int
pStartLayer
,
int
pEndLayer
,
QWidget
*
pParent
)
:
QGraphicsView
(
pParent
)
:
QGraphicsView
(
pParent
)
,
mController
(
pController
)
,
mController
(
pController
)
,
suspendedMousePressEvent
(
NULL
)
,
suspendedMousePressEvent
(
NULL
)
,
mLongPressInterval
(
1000
)
,
mIsDragInProgress
(
false
)
{
{
init
();
init
();
mStartLayer
=
pStartLayer
;
mStartLayer
=
pStartLayer
;
mEndLayer
=
pEndLayer
;
mEndLayer
=
pEndLayer
;
mFilterZIndex
=
true
;
mFilterZIndex
=
true
;
mLongPressTimer
.
setInterval
(
mLongPressInterval
);
mLongPressTimer
.
setSingleShot
(
true
);
}
}
UBBoardView
::~
UBBoardView
()
{
UBBoardView
::~
UBBoardView
()
{
...
@@ -621,10 +632,7 @@ void UBBoardView::rubberItems()
...
@@ -621,10 +632,7 @@ void UBBoardView::rubberItems()
void
UBBoardView
::
moveRubberedItems
(
QPointF
movingVector
)
void
UBBoardView
::
moveRubberedItems
(
QPointF
movingVector
)
{
{
// QRect bandRect = mUBRubberBand->geometry();
QRectF
invalidateRect
=
scene
()
->
itemsBoundingRect
();
//
QRectF
invalidateRect
=
scene
()
->
itemsBoundingRect
();
// QList<QGraphicsItem *> rubberItems = items(bandRect);
foreach
(
QGraphicsItem
*
item
,
mRubberedItems
)
foreach
(
QGraphicsItem
*
item
,
mRubberedItems
)
{
{
...
@@ -644,8 +652,35 @@ void UBBoardView::moveRubberedItems(QPointF movingVector)
...
@@ -644,8 +652,35 @@ void UBBoardView::moveRubberedItems(QPointF movingVector)
scene
()
->
invalidate
(
invalidateRect
);
scene
()
->
invalidate
(
invalidateRect
);
}
}
void
UBBoardView
::
longPressEvent
()
{
UBDrawingController
*
drawingController
=
UBDrawingController
::
drawingController
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
disconnect
(
&
mLongPressTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
longPressEvent
()));
if
(
UBStylusTool
::
Selector
==
currentTool
)
{
drawingController
->
setStylusTool
(
UBStylusTool
::
Play
);
}
else
if
(
currentTool
==
UBStylusTool
::
Play
)
{
drawingController
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
else
if
(
UBStylusTool
::
Eraser
==
currentTool
)
{
UBApplication
::
boardController
->
paletteManager
()
->
toggleErasePalette
(
true
);
}
}
void
UBBoardView
::
mousePressEvent
(
QMouseEvent
*
event
)
void
UBBoardView
::
mousePressEvent
(
QMouseEvent
*
event
)
{
{
mIsDragInProgress
=
false
;
if
(
isAbsurdPoint
(
event
->
pos
()))
if
(
isAbsurdPoint
(
event
->
pos
()))
{
{
event
->
accept
();
event
->
accept
();
...
@@ -680,10 +715,18 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
...
@@ -680,10 +715,18 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mPreviousPoint
=
event
->
posF
();
mPreviousPoint
=
event
->
posF
();
event
->
accept
();
event
->
accept
();
}
}
else
if
(
currentTool
==
UBStylusTool
::
Eraser
)
{
connect
(
&
mLongPressTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
longPressEvent
()));
mLongPressTimer
.
start
();
}
else
if
(
currentTool
==
UBStylusTool
::
Selector
||
currentTool
==
UBStylusTool
::
Play
)
else
if
(
currentTool
==
UBStylusTool
::
Selector
||
currentTool
==
UBStylusTool
::
Play
)
{
{
movingItem
=
scene
()
->
itemAt
(
this
->
mapToScene
(
event
->
posF
().
toPoint
()));
movingItem
=
scene
()
->
itemAt
(
this
->
mapToScene
(
event
->
posF
().
toPoint
()));
connect
(
&
mLongPressTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
longPressEvent
()));
mLongPressTimer
.
start
();
if
(
!
movingItem
)
{
if
(
!
movingItem
)
{
// Rubberband selection implementation
// Rubberband selection implementation
if
(
!
mUBRubberBand
)
{
if
(
!
mUBRubberBand
)
{
...
@@ -692,6 +735,10 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
...
@@ -692,6 +735,10 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mUBRubberBand
->
setGeometry
(
QRect
(
mMouseDownPos
,
QSize
()));
mUBRubberBand
->
setGeometry
(
QRect
(
mMouseDownPos
,
QSize
()));
mUBRubberBand
->
show
();
mUBRubberBand
->
show
();
}
}
else
{
mUBRubberBand
->
hide
();
}
handleItemMousePress
(
event
);
handleItemMousePress
(
event
);
event
->
accept
();
event
->
accept
();
...
@@ -760,6 +807,12 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
...
@@ -760,6 +807,12 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
void
void
UBBoardView
::
mouseMoveEvent
(
QMouseEvent
*
event
)
UBBoardView
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
{
if
(
!
mIsDragInProgress
&&
((
mapToScene
(
event
->
pos
())
-
mLastPressedMousePos
).
manhattanLength
()
<
QApplication
::
startDragDistance
()))
{
return
;
}
mIsDragInProgress
=
true
;
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
if
(
isAbsurdPoint
(
event
->
pos
()))
if
(
isAbsurdPoint
(
event
->
pos
()))
...
@@ -777,12 +830,18 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
...
@@ -777,12 +830,18 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
mPreviousPoint
=
eventPosition
;
mPreviousPoint
=
eventPosition
;
event
->
accept
();
event
->
accept
();
}
}
else
if
(
currentTool
==
UBStylusTool
::
Eraser
)
{
mLongPressTimer
.
stop
();
}
else
if
(
currentTool
==
UBStylusTool
::
Selector
||
currentTool
==
UBStylusTool
::
Play
)
else
if
(
currentTool
==
UBStylusTool
::
Selector
||
currentTool
==
UBStylusTool
::
Play
)
{
{
if
((
event
->
pos
()
-
mLastPressedMousePos
).
manhattanLength
()
<
QApplication
::
startDragDistance
())
{
if
((
event
->
pos
()
-
mLastPressedMousePos
).
manhattanLength
()
<
QApplication
::
startDragDistance
())
{
return
;
return
;
}
}
mLongPressTimer
.
stop
();
if
(
!
movingItem
&&
(
mMouseButtonIsPressed
||
mTabletStylusIsPressed
)
&&
mUBRubberBand
&&
mUBRubberBand
->
isVisible
())
{
if
(
!
movingItem
&&
(
mMouseButtonIsPressed
||
mTabletStylusIsPressed
)
&&
mUBRubberBand
&&
mUBRubberBand
->
isVisible
())
{
QRect
bandRect
(
mMouseDownPos
,
event
->
pos
());
QRect
bandRect
(
mMouseDownPos
,
event
->
pos
());
...
@@ -963,6 +1022,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
...
@@ -963,6 +1022,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
mPendingStylusReleaseEvent
=
false
;
mPendingStylusReleaseEvent
=
false
;
mTabletStylusIsPressed
=
false
;
mTabletStylusIsPressed
=
false
;
mLongPressTimer
.
stop
();
}
}
void
void
...
...
src/board/UBBoardView.h
View file @
3fac754e
...
@@ -142,6 +142,11 @@ class UBBoardView : public QGraphicsView
...
@@ -142,6 +142,11 @@ class UBBoardView : public QGraphicsView
QList
<
QGraphicsItem
*>
mRubberedItems
;
QList
<
QGraphicsItem
*>
mRubberedItems
;
QSet
<
QGraphicsItem
*>
mJustSelectedItems
;
QSet
<
QGraphicsItem
*>
mJustSelectedItems
;
int
mLongPressInterval
;
QTimer
mLongPressTimer
;
bool
mIsDragInProgress
;
private
slots
:
private
slots
:
void
settingChanged
(
QVariant
newValue
);
void
settingChanged
(
QVariant
newValue
);
...
@@ -149,6 +154,7 @@ class UBBoardView : public QGraphicsView
...
@@ -149,6 +154,7 @@ class UBBoardView : public QGraphicsView
public
slots
:
public
slots
:
void
virtualKeyboardActivated
(
bool
b
);
void
virtualKeyboardActivated
(
bool
b
);
void
longPressEvent
();
};
};
...
...
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