+ if (!transitionsToMove.isEmpty()) {
+ // Make sure that by moving the items, we don't get a transition collision
+ // Find first transition
+ ItemInfo info = transitionsToMove.at(0);
+ for (int i = 1; i < transitionsToMove.count(); i++)
+ if (transitionsToMove.at(i).startPos < info.startPos) info = transitionsToMove.at(i);
+
+ // make sure there are no transitions on the way
+ QRectF rect(info.startPos.frames(m_document->fps()) - length, track * m_tracksHeight + m_tracksHeight / 2, length - 1, m_tracksHeight / 2 - 2);
+ items = scene()->items(rect);
+ int transitionCorrection = -1;
+ for (int i = 0; i < items.count(); i++) {
+ if (items.at(i)->type() == TRANSITIONWIDGET) {
+ // There is a transition on the way
+ AbstractClipItem *item = static_cast <AbstractClipItem *>(items.at(i));
+ int transitionEnd = item->endPos().frames(m_document->fps());
+ if (transitionEnd > transitionCorrection) transitionCorrection = transitionEnd;
+ }
+ }
+
+ if (transitionCorrection > 0) {
+ // We need to fix the move length
+ length = info.startPos.frames(m_document->fps()) - transitionCorrection;
+ }
+
+ // Make sure we don't send transition before 0
+ if (info.startPos.frames(m_document->fps()) < length) {
+ // reduce length to maximum possible
+ length = info.startPos.frames(m_document->fps());
+ }
+ }
+