I agree with Hugo the way we're taught at school, no problem...<br>Okay if we're to use it, perhaps refactor it to something like this:<br><br> //Check if the item moved.<br>- if ( effectItem != NULL )<br>
+ if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() )<br> {<br>- if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() )<br>+ if( effectItem != NULL )<br>
{<br> const AbstractGraphicsMediaItem *container = effectItem->container();<br>- if ( container != NULL && container->startPos() + effectItem->begin() == effectItem->startPos() )<br>
- goto out;<br>- else if ( container == NULL && effectItem->startPos() == effectItem->begin() )<br>+ if ( ( container != NULL && container->startPos() + effectItem->begin() == effectItem->startPos() ) ||<br>
+ ( container == NULL && effectItem->startPos() == effectItem->begin() ) )<br> goto out;<br> }<br>- }<br>- else<br>- {<br>- if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() &&<br>
- m_actionItem->startPos() == m_actionItem->track()->trackWorkflow()->getClipPosition( m_actionItem->uuid() ) )<br>+ else if ( m_actionItem->startPos() == m_actionItem->track()->trackWorkflow()->getClipPosition( m_actionItem->uuid() ) )<br>
goto out;<br> }<br><br>Before this, I worked on this solution without the <i>goto</i>:<br><br>diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp<br>index 2fcbf10..5c28cc9 100644<br>
--- a/src/Gui/timeline/TracksView.cpp<br>+++ b/src/Gui/timeline/TracksView.cpp<br>@@ -1131,22 +1131,27 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )<br> GraphicsEffectItem *effectItem = qgraphicsitem_cast<GraphicsEffectItem*>( m_actionItem );<br>
<br> //Check if the item moved.<br>- if ( effectItem != NULL )<br>+ if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() )<br> {<br>- if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() )<br>
+ bool isMoved = false;<br>+ if( effectItem != NULL )<br> {<br> const AbstractGraphicsMediaItem *container = effectItem->container();<br>- if ( container != NULL && container->startPos() + effectItem->begin() == effectItem->startPos() )<br>
- goto out;<br>- else if ( container == NULL && effectItem->startPos() == effectItem->begin() )<br>- goto out;<br>+ if ( ( container != NULL && container->startPos() + effectItem->begin() == effectItem->startPos() ) ||<br>
+ ( container == NULL && effectItem->startPos() == effectItem->begin() ) )<br>+ isMoved = true;<br>+ }<br>+ else if ( m_actionItem->startPos() == m_actionItem->track()->trackWorkflow()->getClipPosition( m_actionItem->uuid() ) )<br>
+ isMoved = true;<br>+<br>+ if( isMoved )<br>+ {<br>+ m_effectTarget = NULL;<br>+ m_actionItem = NULL;<br>+ m_action = TracksView::None;<br>
+ //setDragMode( QGraphicsView::NoDrag );<br>+ QGraphicsView::mouseReleaseEvent( event );<br> }<br>- }<br>- else<br>- {<br>- if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() &&<br>
- m_actionItem->startPos() == m_actionItem->track()->trackWorkflow()->getClipPosition( m_actionItem->uuid() ) )<br>- goto out;<br> }<br> <br> updateDuration();<br>
@@ -1209,7 +1214,6 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )<br> updateDuration();<br> }<br> <br>-out:<br> m_effectTarget = NULL;<br> m_actionItem = NULL;<br> m_action = TracksView::None;<br>
<br><br>Cheers,<br>Rohit<br>