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
e42bb6c0
Commit
e42bb6c0
authored
Feb 10, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first step for fixing the wacom problem on linux
parent
70a204a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
65 deletions
+60
-65
UBBoardView.cpp
src/board/UBBoardView.cpp
+60
-65
No files found.
src/board/UBBoardView.cpp
View file @
e42bb6c0
...
...
@@ -282,86 +282,82 @@ UBBoardView::event (QEvent * e)
return
QGraphicsView
::
event
(
e
);
}
void
UBBoardView
::
tabletEvent
(
QTabletEvent
*
event
)
void
UBBoardView
::
tabletEvent
(
QTabletEvent
*
event
)
{
if
(
!
mUseHighResTabletEvent
)
{
event
->
setAccepted
(
false
);
return
;
if
(
!
mUseHighResTabletEvent
)
{
event
->
setAccepted
(
false
);
return
;
}
UBDrawingController
*
dc
=
UBDrawingController
::
drawingController
();
qDebug
()
<<
"tableEvent position "
<<
event
->
pos
();
qDebug
()
<<
"tableEvent global position "
<<
event
->
globalPos
();
QPointF
tabletPos
=
UBGeometryUtils
::
pointConstrainedInRect
(
event
->
hiResGlobalPos
()
-
mapToGlobal
(
QPoint
(
0
,
0
)),
rect
());
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
dc
->
stylusTool
();
UBDrawingController
*
dc
=
UBDrawingController
::
drawingController
();
if
(
event
->
type
()
==
QEvent
::
TabletPress
||
event
->
type
()
==
QEvent
::
TabletEnterProximity
)
{
if
(
event
->
pointerType
()
==
QTabletEvent
::
Eraser
)
{
dc
->
setStylusTool
(
UBStylusTool
::
Eraser
);
mUsingTabletEraser
=
true
;
QPointF
tabletPos
=
UBGeometryUtils
::
pointConstrainedInRect
(
event
->
hiResGlobalPos
()
-
mapToGlobal
(
QPoint
(
0
,
0
)),
rect
());
// QPointF tabletPos = event->pos();
qDebug
()
<<
"tabletPos "
<<
tabletPos
;
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
dc
->
stylusTool
();
if
(
event
->
type
()
==
QEvent
::
TabletPress
||
event
->
type
()
==
QEvent
::
TabletEnterProximity
)
{
if
(
event
->
pointerType
()
==
QTabletEvent
::
Eraser
)
{
dc
->
setStylusTool
(
UBStylusTool
::
Eraser
);
mUsingTabletEraser
=
true
;
}
else
{
if
(
mUsingTabletEraser
&&
currentTool
==
UBStylusTool
::
Eraser
)
{
dc
->
setStylusTool
(
dc
->
latestDrawingTool
());
}
else
{
if
(
mUsingTabletEraser
&&
currentTool
==
UBStylusTool
::
Eraser
)
dc
->
setStylusTool
(
dc
->
latestDrawingTool
());
mUsingTabletEraser
=
false
;
mUsingTabletEraser
=
false
;
}
}
// if event are not Pen events, we drop the tablet stuff and route everything through mouse event
if
(
currentTool
!=
UBStylusTool
::
Pen
&&
currentTool
!=
UBStylusTool
::
Line
&&
currentTool
!=
UBStylusTool
::
Marker
&&
!
mMarkerPressureSensitive
)
{
event
->
setAccepted
(
false
);
return
;
// if event are not Pen events, we drop the tablet stuff and route everything through mouse event
if
(
currentTool
!=
UBStylusTool
::
Pen
&&
currentTool
!=
UBStylusTool
::
Line
&&
currentTool
!=
UBStylusTool
::
Marker
&&
!
mMarkerPressureSensitive
){
event
->
setAccepted
(
false
);
return
;
}
QPointF
scenePos
=
viewportTransform
().
inverted
().
map
(
tabletPos
);
QPointF
scenePos
=
viewportTransform
().
inverted
().
map
(
tabletPos
);
qDebug
()
<<
"scene Pos "
<<
scenePos
;
qreal
pressure
=
1.0
;
if
(((
currentTool
==
UBStylusTool
::
Pen
||
currentTool
==
UBStylusTool
::
Line
)
&&
mPenPressureSensitive
)
||
(
currentTool
==
UBStylusTool
::
Marker
&&
mMarkerPressureSensitive
))
{
pressure
=
event
->
pressure
();
}
qreal
pressure
=
1.0
;
if
(((
currentTool
==
UBStylusTool
::
Pen
||
currentTool
==
UBStylusTool
::
Line
)
&&
mPenPressureSensitive
)
||
(
currentTool
==
UBStylusTool
::
Marker
&&
mMarkerPressureSensitive
))
pressure
=
event
->
pressure
();
bool
acceptEvent
=
true
;
switch
(
event
->
type
())
{
case
QEvent
:
:
TabletPress
:
{
mTabletStylusIsPressed
=
true
;
bool
acceptEvent
=
true
;
switch
(
event
->
type
())
{
case
QEvent
:
:
TabletPress
:
{
qDebug
()
<<
"TabletPress"
;
scene
()
->
inputDevicePress
(
scenePos
,
pressure
);
mTabletStylusIsPressed
=
true
;
scene
()
->
inputDevicePress
(
scenePos
,
pressure
);
break
;
}
case
QEvent
:
:
TabletMove
:
{
}
case
QEvent
:
:
TabletMove
:
{
qDebug
()
<<
"TabletMove"
;
if
(
mTabletStylusIsPressed
)
{
scene
()
->
inputDeviceMove
(
scenePos
,
pressure
);
}
acceptEvent
=
false
;
// rerouted to mouse move
break
;
}
case
QEvent
:
:
TabletRelease
:
{
}
case
QEvent
:
:
TabletRelease
:
{
qDebug
()
<<
"TabletRelease"
;
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
dc
->
stylusTool
();
scene
()
->
setToolCursor
(
currentTool
);
setToolCursor
(
currentTool
);
...
...
@@ -374,22 +370,21 @@ UBBoardView::tabletEvent (QTabletEvent * event)
mMouseButtonIsPressed
=
false
;
break
;
}
default
:
{
}
default
:
{
//NOOP - avoid compiler warning
}
}
}
// ignore mouse press and mouse move tablet event so that it is rerouted to mouse events,
// documented in QTabletEvent Class Reference:
/* The event handler QWidget::tabletEvent() receives all three types of tablet events.
// ignore mouse press and mouse move tablet event so that it is rerouted to mouse events,
// documented in QTabletEvent Class Reference:
/* The event handler QWidget::tabletEvent() receives all three types of tablet events.
Qt will first send a tabletEvent then, if it is not accepted, it will send a mouse event. */
//
// This is a workaround to the fact that tablet event are not delivered to child widget (like palettes)
//
//
// This is a workaround to the fact that tablet event are not delivered to child widget (like palettes)
//
event
->
setAccepted
(
acceptEvent
);
event
->
setAccepted
(
acceptEvent
);
}
...
...
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