]> git.sesse.net Git - kdenlive/commitdiff
rotoscoping: allow deleting spline vertices using the right mouse button
authorTill Theato <root@ttill.de>
Tue, 1 Feb 2011 21:52:18 +0000 (21:52 +0000)
committerTill Theato <root@ttill.de>
Tue, 1 Feb 2011 21:52:18 +0000 (21:52 +0000)
svn path=/trunk/kdenlive/; revision=5375

src/onmonitoritems/rotoscoping/bpointitem.cpp
src/onmonitoritems/rotoscoping/splineitem.cpp
src/onmonitoritems/rotoscoping/splineitem.h

index 60e90028269bc0ea4b1dcdfd49cb7c6256baabbd..4129a17d7a925758dcd57b22218ce5a88f2c7733 100644 (file)
@@ -123,6 +123,13 @@ void BPointItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
         event->ignore();
         setSelected(false);
     } else {
+        if (event->button() == Qt::RightButton && m_selection == 1) {
+            SplineItem *parent = qgraphicsitem_cast<SplineItem*>(parentItem());
+            if (parent) {
+                parent->removeChild(this);
+                return;
+            }
+        }
         setSelected(true);
     }
 }
index dba70d24bdce2d58ce505b2c00ae8642d8adcfb5..06228b02b1f8d7e566f29ed3ef64281c86044b47 100644 (file)
@@ -103,6 +103,15 @@ QList <BPoint> SplineItem::getPoints()
     return points;
 }
 
+void SplineItem::removeChild(QGraphicsItem* child)
+{
+    if (childItems().count() > 2) {
+        scene()->removeItem(child);
+        delete child;
+        updateSpline();
+    }
+}
+
 void SplineItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
 {
     QGraphicsItem::mousePressEvent(event);
index 1f3dac1da8e86d62b2d42e1472de47303d6149fd..a6d53387f8816fdec85e0cf236bab1839676e9f0 100644 (file)
@@ -38,6 +38,8 @@ public:
     void updateSpline();
     QList <BPoint> getPoints();
 
+    void removeChild(QGraphicsItem *child);
+
 protected:
     virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);