+
+ // Check if top item is a clip or a transition
+ int offset = 0;
+ int topTrack = -1;
+ QList<QGraphicsItem *> children = childItems();
+ for (int i = 0; i < children.count(); i++) {
+ int currentTrack = (int)(children.at(i)->scenePos().y() / trackHeight);
+ if (children.at(i)->type() == AVWIDGET) {
+ kDebug() << "// CLIP ITEM TRK: " << currentTrack << "; POS: " << children.at(i)->scenePos().y();
+ if (topTrack == -1 || currentTrack <= topTrack) {
+ offset = 0;
+ topTrack = currentTrack;
+ }
+ } else if (children.at(i)->type() == TRANSITIONWIDGET) {
+ kDebug() << "// TRANS ITEM TRK: " << currentTrack << "; POS: " << children.at(i)->scenePos().y();
+ if (topTrack == -1 || currentTrack < topTrack) {
+ offset = (int)(trackHeight / 3 * 2 - 1);
+ topTrack = currentTrack;
+ }
+ }
+ }
+ kDebug() << "// OFFSET: " << offset << "\n------------------------------------\n------------";
+
+ newPos.setY((int)((newTrack) * trackHeight) + offset);