Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
ba069876
Commit
ba069876
authored
Jun 21, 2009
by
Ludovic Fauvet
Browse files
Items are moveable
parent
7e7080cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/gui/TracksView.cpp
View file @
ba069876
...
...
@@ -47,6 +47,9 @@ TracksView::TracksView( QGraphicsScene* scene, MainWorkflow* mainWorkflow, QWidg
m_numVideoTrack
=
0
;
m_videoTracksCounter
=
MAX_TRACKS
;
m_dragItem
=
NULL
;
m_actionMove
=
false
;
m_actionRelativeX
=
-
1
;
m_actionItem
=
NULL
;
setMouseTracking
(
true
);
setAcceptDrops
(
true
);
...
...
@@ -300,6 +303,15 @@ void TracksView::drawBackground( QPainter* painter, const QRectF& rect )
void
TracksView
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
if
(
event
->
modifiers
()
==
Qt
::
NoModifier
&&
event
->
buttons
()
==
Qt
::
LeftButton
&&
m_actionMove
==
true
)
{
if
(
m_actionRelativeX
<
0
)
m_actionRelativeX
=
event
->
pos
().
x
()
-
mapFromScene
(
m_actionItem
->
pos
()
).
x
();
moveMediaItem
(
m_actionItem
,
QPoint
(
event
->
pos
().
x
()
-
m_actionRelativeX
,
event
->
pos
().
y
()
)
);
}
QGraphicsView
::
mouseMoveEvent
(
event
);
}
...
...
@@ -314,6 +326,15 @@ void TracksView::mousePressEvent( QMouseEvent* event )
return
;
}
if
(
event
->
modifiers
()
==
Qt
::
NoModifier
&&
event
->
button
()
==
Qt
::
LeftButton
&&
mediaCollisionList
.
count
()
==
1
)
{
m_actionMove
=
true
;
m_actionItem
=
mediaCollisionList
.
at
(
0
);
return
;
}
/*if ( event->modifiers() & Qt::ShiftModifier && collisionList.count() == 0 )
{
setDragMode( QGraphicsView::RubberBandDrag );
...
...
@@ -328,6 +349,13 @@ void TracksView::mousePressEvent( QMouseEvent* event )
void
TracksView
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
if
(
m_actionMove
)
{
m_actionMove
=
false
;
m_actionRelativeX
=
-
1
;
m_actionItem
=
NULL
;
}
setDragMode
(
QGraphicsView
::
NoDrag
);
QGraphicsView
::
mouseReleaseEvent
(
event
);
}
...
...
src/gui/TracksView.h
View file @
ba069876
...
...
@@ -119,6 +119,11 @@ private:
GraphicsMovieItem
*
m_dragItem
;
QGraphicsWidget
*
m_separator
;
// Mouse actions on Medias
bool
m_actionMove
;
int
m_actionRelativeX
;
AbstractGraphicsMediaItem
*
m_actionItem
;
signals:
void
zoomIn
();
void
zoomOut
();
...
...
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