Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
a706dc31
Commit
a706dc31
authored
Dec 05, 2009
by
Ludovic Fauvet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a matrix to calculate the resize anchors of an item.
This fixes some mouse cursor issues.
parent
0b8dbcd4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
src/GUI/GraphicsMovieItem.cpp
src/GUI/GraphicsMovieItem.cpp
+22
-6
src/GUI/GraphicsMovieItem.h
src/GUI/GraphicsMovieItem.h
+1
-0
No files found.
src/GUI/GraphicsMovieItem.cpp
View file @
a706dc31
...
...
@@ -192,11 +192,7 @@ void GraphicsMovieItem::hoverMoveEvent( QGraphicsSceneHoverEvent* event )
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
{
QPoint
mouseMapped
=
tracksView
()
->
mapFromScene
(
event
->
pos
()
);
QPoint
sizeMapped
=
tracksView
()
->
mapFromScene
(
boundingRect
().
width
(),
boundingRect
().
height
()
);
if
(
mouseMapped
.
x
()
<
RESIZE_ZONE
||
mouseMapped
.
x
()
>
(
sizeMapped
.
x
()
-
RESIZE_ZONE
)
)
if
(
resizeZone
(
event
->
pos
()
)
)
setCursor
(
Qt
::
SizeHorCursor
);
else
setCursor
(
Qt
::
OpenHandCursor
);
...
...
@@ -208,7 +204,12 @@ void GraphicsMovieItem::mousePressEvent( QGraphicsSceneMouseEvent* event )
if
(
!
tracksView
()
)
return
;
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
setCursor
(
Qt
::
ClosedHandCursor
);
{
if
(
resizeZone
(
event
->
pos
()
)
)
setCursor
(
Qt
::
SizeHorCursor
);
else
setCursor
(
Qt
::
ClosedHandCursor
);
}
else
if
(
tracksView
()
->
tool
()
==
TOOL_CUT
)
emit
split
(
this
,
qRound64
(
event
->
pos
().
x
()
)
);
}
...
...
@@ -221,3 +222,18 @@ void GraphicsMovieItem::mouseReleaseEvent( QGraphicsSceneMouseEvent* event )
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
setCursor
(
Qt
::
OpenHandCursor
);
}
bool
GraphicsMovieItem
::
resizeZone
(
const
QPointF
&
position
)
{
// Get the current transformation of the view and invert it.
QTransform
transform
=
tracksView
()
->
transform
().
inverted
();
// Map the RESIZE_ZONE distance from the view to the item coordinates.
QLine
line
=
transform
.
map
(
QLine
(
0
,
0
,
RESIZE_ZONE
,
0
)
);
if
(
position
.
x
()
<
line
.
x2
()
||
position
.
x
()
>
(
boundingRect
().
width
()
-
line
.
x2
()
)
)
{
return
true
;
}
return
false
;
}
src/GUI/GraphicsMovieItem.h
View file @
a706dc31
...
...
@@ -60,6 +60,7 @@ protected:
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
private:
bool
resizeZone
(
const
QPointF
&
position
);
Clip
*
m_clip
;
signals:
...
...
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