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
b5bda890
Commit
b5bda890
authored
Oct 17, 2011
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SANKORE-139 refactoring mouse scroll processing for View and GraphicsItems
parent
5b350365
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
7 deletions
+29
-7
UBBoardView.cpp
src/board/UBBoardView.cpp
+24
-5
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+2
-2
UBGraphicsProxyWidget.cpp
src/domain/UBGraphicsProxyWidget.cpp
+3
-0
No files found.
src/board/UBBoardView.cpp
View file @
b5bda890
...
...
@@ -634,18 +634,38 @@ UBBoardView::mouseDoubleClickEvent (QMouseEvent *event)
}
void
UBBoardView
::
wheelEvent
(
QWheelEvent
*
e
vent
)
UBBoardView
::
wheelEvent
(
QWheelEvent
*
wheelE
vent
)
{
if
(
isInteractive
()
&&
e
vent
->
orientation
()
==
Qt
::
Vertical
)
if
(
isInteractive
()
&&
wheelE
vent
->
orientation
()
==
Qt
::
Vertical
)
{
// Too many wheelEvent are sent, how should we handle them to "smoothly" zoom ?
// something like zoom( pow(zoomFactor, event->delta() / 120) )
// use DateTime man, store last event time, and if if less than 300ms than this is one big scroll
// and move scroll with one const speed.
// so, you no will related with scroll event count
}
// event->accept ();
QGraphicsView
::
wheelEvent
(
event
);
QList
<
QGraphicsItem
*>
selItemsList
=
scene
()
->
selectedItems
();
// if NO have selected items, than no need process mouse wheel. just exist
if
(
selItemsList
.
count
()
>
0
)
{
// only one selected item possible, so we will work with first item only
QGraphicsItem
*
selItem
=
selItemsList
[
0
];
// get items list under mouse cursor
QPointF
scenePos
=
mapToScene
(
wheelEvent
->
pos
());
QList
<
QGraphicsItem
*>
itemsList
=
scene
()
->
items
(
scenePos
);
QBool
isSlectedAndMouseHower
=
itemsList
.
contains
(
selItem
);
if
(
isSlectedAndMouseHower
)
{
wheelEvent
->
accept
();
QGraphicsView
::
wheelEvent
(
wheelEvent
);
}
}
}
void
...
...
@@ -895,4 +915,3 @@ UBBoardView::setToolCursor (int tool)
}
}
src/domain/UBGraphicsItemDelegate.cpp
View file @
b5bda890
...
...
@@ -195,12 +195,12 @@ bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event)
{
if
(
mDelegated
->
isSelected
()
)
{
event
->
accept
();
//
event->accept();
return
true
;
}
else
{
event
->
ignore
();
//
event->ignore();
return
false
;
}
}
...
...
src/domain/UBGraphicsProxyWidget.cpp
View file @
b5bda890
...
...
@@ -105,7 +105,10 @@ void UBGraphicsProxyWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void
UBGraphicsProxyWidget
::
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
)
{
if
(
mDelegate
->
weelEvent
(
event
)
)
{
QGraphicsProxyWidget
::
wheelEvent
(
event
);
event
->
accept
();
}
}
...
...
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