]> git.sesse.net Git - kdenlive/commitdiff
Workaround dragging timeline clips on another track not reliable:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 1 Sep 2012 20:50:19 +0000 (22:50 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 1 Sep 2012 20:50:19 +0000 (22:50 +0200)
http://kdenlive.org/mantis/view.php?id=2670

src/clipitem.cpp
src/customtrackview.cpp

index e00b59b4c06707616a961470c565a97cca0de3e5..ba8cb455666ff5a8b6ef6a81511c2f1c678c91f2 100644 (file)
@@ -1301,7 +1301,9 @@ QVariant ClipItem::itemChange(GraphicsItemChange change, const QVariant &value)
         int xpos = projectScene()->getSnapPointForPos((int) newPos.x(), KdenliveSettings::snaptopoints());
         xpos = qMax(xpos, 0);
         newPos.setX(xpos);
-        int newTrack = newPos.y() / KdenliveSettings::trackheight();
+       // Warning: newPos gives a position relative to the click event, so hack to get absolute pos
+       int yOffset = property("y_absolute").toInt() + newPos.y();
+        int newTrack = yOffset / KdenliveSettings::trackheight();
         newTrack = qMin(newTrack, projectScene()->tracksCount() - 1);
         newTrack = qMax(newTrack, 0);
         newPos.setY((int)(newTrack  * KdenliveSettings::trackheight() + 1));
index b23108f664542c5c4dbed6e1cad2dc11de8aa339..5fb7afc3cdefae064fa9813d8f78d0c0199cb16c 100644 (file)
@@ -422,6 +422,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
         bool move = (event->pos() - m_clickEvent).manhattanLength() >= QApplication::startDragDistance();
         if (m_dragItem && m_tool == SELECTTOOL) {
             if (m_operationMode == MOVE && move) {
+               //m_dragItem->setProperty("y_absolute", event->pos().y());
                 QGraphicsView::mouseMoveEvent(event);
                 // If mouse is at a border of the view, scroll
                 if (pos < 5) {
@@ -799,6 +800,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
             else
                 m_dragItem = collisionClip;
             found = true;
+           m_dragItem->setProperty("y_absolute", m_clickEvent.y() - m_dragItem->scenePos().y());
             m_dragItemInfo = m_dragItem->info();
             if (m_dragItem->parentItem() && m_dragItem->parentItem()->type() == GROUPWIDGET && m_dragItem->parentItem() != m_selectionGroup) {
                 // kDebug()<<"// KLIK FOUND GRP: "<<m_dragItem->sceneBoundingRect();