Commit 32ef2eec authored by Ludovic Fauvet's avatar Ludovic Fauvet

Only notify a move event to the backend if it really happened

parent 410b280a
...@@ -346,6 +346,9 @@ void TracksView::mouseMoveEvent( QMouseEvent* event ) ...@@ -346,6 +346,9 @@ void TracksView::mouseMoveEvent( QMouseEvent* event )
event->buttons() == Qt::LeftButton && event->buttons() == Qt::LeftButton &&
m_actionMove == true ) m_actionMove == true )
{ {
// The move action is obviously executed
m_actionMoveExecuted = true;
if ( m_actionRelativeX < 0 ) if ( m_actionRelativeX < 0 )
m_actionRelativeX = event->pos().x() - mapFromScene( m_actionItem->pos() ).x(); m_actionRelativeX = event->pos().x() - mapFromScene( m_actionItem->pos() ).x();
moveMediaItem( m_actionItem, QPoint( event->pos().x() - m_actionRelativeX, event->pos().y() ) ); moveMediaItem( m_actionItem, QPoint( event->pos().x() - m_actionRelativeX, event->pos().y() ) );
...@@ -373,6 +376,7 @@ void TracksView::mousePressEvent( QMouseEvent* event ) ...@@ -373,6 +376,7 @@ void TracksView::mousePressEvent( QMouseEvent* event )
if ( item->moveable() ) if ( item->moveable() )
{ {
m_actionMove = true; m_actionMove = true;
m_actionMoveExecuted = false;
m_actionItem = mediaCollisionList.at( 0 ); m_actionItem = mediaCollisionList.at( 0 );
} }
return; return;
...@@ -392,7 +396,7 @@ void TracksView::mousePressEvent( QMouseEvent* event ) ...@@ -392,7 +396,7 @@ void TracksView::mousePressEvent( QMouseEvent* event )
void TracksView::mouseReleaseEvent( QMouseEvent* event ) void TracksView::mouseReleaseEvent( QMouseEvent* event )
{ {
if ( m_actionMove ) if ( m_actionMove && m_actionMoveExecuted )
{ {
GraphicsMovieItem* movieItem = qgraphicsitem_cast<GraphicsMovieItem*>( m_actionItem ); GraphicsMovieItem* movieItem = qgraphicsitem_cast<GraphicsMovieItem*>( m_actionItem );
if ( movieItem ) if ( movieItem )
......
...@@ -132,6 +132,7 @@ private: ...@@ -132,6 +132,7 @@ private:
// Mouse actions on Medias // Mouse actions on Medias
bool m_actionMove; bool m_actionMove;
bool m_actionMoveExecuted;
int m_actionRelativeX; int m_actionRelativeX;
AbstractGraphicsMediaItem* m_actionItem; AbstractGraphicsMediaItem* m_actionItem;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment