]> git.sesse.net Git - kdenlive/blobdiff - src/abstractgroupitem.cpp
Fix moving of keyframes in composite transitions
[kdenlive] / src / abstractgroupitem.cpp
index aed9c10837da7393ee33ca90ba8891723d678511..f99fd3ee73ac7c8328511989b827bc5732fe3b3e 100644 (file)
@@ -38,6 +38,9 @@ AbstractGroupItem::AbstractGroupItem(double /* fps */) :
 {
     setZValue(1);
     setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+#if QT_VERSION >= 0x040600
+    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
+#endif
     setAcceptDrops(true);
 }
 
@@ -51,6 +54,23 @@ int AbstractGroupItem::track() const
     return (int)(scenePos().y() / KdenliveSettings::trackheight());
 }
 
+void AbstractGroupItem::setItemLocked(bool locked)
+{
+    if (locked) {
+        setSelected(false);
+        setFlag(QGraphicsItem::ItemIsMovable, false);
+        setFlag(QGraphicsItem::ItemIsSelectable, false);
+    } else {
+        setFlag(QGraphicsItem::ItemIsMovable, true);
+        setFlag(QGraphicsItem::ItemIsSelectable, true);
+    }
+}
+
+bool AbstractGroupItem::isItemLocked() const
+{
+    return !(flags() & (QGraphicsItem::ItemIsSelectable));
+}
+
 CustomTrackScene* AbstractGroupItem::projectScene()
 {
     if (scene()) return static_cast <CustomTrackScene*>(scene());
@@ -195,12 +215,15 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
             return QPointF(pos().x() - start.x(), pos().y());
         }*/
 
-        QPainterPath shape = clipGroupShape(newPos - pos());
-        QList<QGraphicsItem*> collindingItems = scene()->items(shape, Qt::IntersectsItemShape);
-        for (int i = 0; i < children.count(); i++) {
-            collindingItems.removeAll(children.at(i));
+        QList<QGraphicsItem*> collindingItems;
+        QPainterPath shape;
+        if (projectScene()->editMode() == NORMALEDIT) {
+            shape = clipGroupShape(newPos - pos());
+            collindingItems = scene()->items(shape, Qt::IntersectsItemShape);
+            for (int i = 0; i < children.count(); i++) {
+                collindingItems.removeAll(children.at(i));
+            }
         }
-
         if (!collindingItems.isEmpty()) {
             bool forwardMove = xpos > start.x();
             int offset = 0;
@@ -244,11 +267,12 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
             }
         }
 
-
-        shape = transitionGroupShape(newPos - pos());
-        collindingItems = scene()->items(shape, Qt::IntersectsItemShape);
-        for (int i = 0; i < children.count(); i++) {
-            collindingItems.removeAll(children.at(i));
+        if (projectScene()->editMode() == NORMALEDIT) {
+            shape = transitionGroupShape(newPos - pos());
+            collindingItems = scene()->items(shape, Qt::IntersectsItemShape);
+            for (int i = 0; i < children.count(); i++) {
+                collindingItems.removeAll(children.at(i));
+            }
         }
         if (collindingItems.isEmpty()) return newPos;
         else {