]> git.sesse.net Git - kdenlive/blobdiff - src/graphicsscenerectmove.cpp
* New: audio fade in / out by dragging a clip's top corner
[kdenlive] / src / graphicsscenerectmove.cpp
index 6e47bb19e76d6d0b197fa6c7fc378a5b82885286..26af61c73015d64cd1ff8cfc58d4a7c0f1321627 100644 (file)
@@ -49,6 +49,13 @@ void GraphicsSceneRectMove::keyPressEvent(QKeyEvent * keyEvent) {
         return;
     }
     int diff = 1;
+    if (m_selectedItem->type() == 8) {
+        QGraphicsTextItem *t = static_cast<QGraphicsTextItem *>(m_selectedItem);
+        if (t->textInteractionFlags() & Qt::TextEditorInteraction) {
+            QGraphicsScene::keyPressEvent(keyEvent);
+            return;
+        }
+    }
     if (keyEvent->modifiers() & Qt::ControlModifier) diff = 10;
     switch (keyEvent->key()) {
     case Qt::Key_Left:
@@ -109,7 +116,7 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e) {
     bool hasSelected = false;
 
     if (m_tool == TITLE_SELECT) {
-        foreach(QGraphicsItemg, list) {
+        foreach(QGraphicsItem *g, list) {
             kDebug() << " - - CHECKING ITEM Z:" << g->zValue() << ", TYPE: " << g->type();
             // check is there is a selected item in list
             if (g->zValue() > -1000 && g->isSelected()) {
@@ -145,7 +152,11 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e) {
                 t->setTextInteractionFlags(Qt::NoTextInteraction);
                 setCursor(Qt::ClosedHandCursor);
             } else if (item->type() == 3 || item->type() == 13 || item->type() == 7) {
-                QRectF r = item->boundingRect();
+                QRectF r;
+                if (m_selectedItem->type() == 3) {
+                    r = ((QGraphicsRectItem*)m_selectedItem)->rect();
+                } else r = m_selectedItem->boundingRect();
+
                 r.translate(item->scenePos());
                 if ((r.toRect().topLeft() - e->scenePos().toPoint()).manhattanLength() < 6 / zoom) {
                     resizeMode = TopLeft;
@@ -189,7 +200,11 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e) {
 
     if (m_selectedItem && e->buttons() & Qt::LeftButton) {
         if (m_selectedItem->type() == 3 || m_selectedItem->type() == 13 || m_selectedItem->type() == 7) {
-            QRectF newrect = m_selectedItem->boundingRect();
+            QRectF newrect;
+            if (m_selectedItem->type() == 3) {
+                newrect = ((QGraphicsRectItem*)m_selectedItem)->rect();
+            } else newrect = m_selectedItem->boundingRect();
+
             QPointF newpoint = e->scenePos();
             //newpoint -= m_selectedItem->scenePos();
             switch (resizeMode) {
@@ -228,7 +243,7 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e) {
                 m_selectedItem->moveBy(diff.x(), diff.y());
                 break;
             }
-            if (m_selectedItem->type() == 3) {
+            if (m_selectedItem->type() == 3 && resizeMode != NoResize) {
                 QGraphicsRectItem *gi = (QGraphicsRectItem*)m_selectedItem;
                 gi->setRect(newrect);
             }
@@ -261,13 +276,13 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e) {
         p += QPoint(-2, -2);
         resizeMode = NoResize;
         bool itemFound = false;
-        foreach(QGraphicsItem* g, items(QRectF(p , QSizeF(4, 4)).toRect())) {
+        foreach(const QGraphicsItem* g, items(QRectF(p , QSizeF(4, 4)).toRect())) {
             if ((g->type() == 13 || g->type() == 7) && g->zValue() > -1000) {
                 // image or svg item
                 setCursor(Qt::OpenHandCursor);
                 break;
             } else if (g->type() == 3 && g->zValue() > -1000) {
-                QRectF r = g->boundingRect();
+                QRectF r = ((QGraphicsRectItem*)g)->rect();
                 r.translate(g->scenePos());
                 itemFound = true;
                 if ((r.toRect().topLeft() - e->scenePos().toPoint()).manhattanLength() < 6 / zoom) {