]> git.sesse.net Git - kdenlive/blobdiff - src/graphicsscenerectmove.cpp
Various fixes to improve general stability in Qt 4.5.2
[kdenlive] / src / graphicsscenerectmove.cpp
index 5274a461f2ac2025a82181d3989795ae30ddab56..275c2a4da4fa0e8271d1a44ce541f5a8be78c8be 100644 (file)
@@ -72,7 +72,6 @@ void GraphicsSceneRectMove::setTool(TITLETOOL tool)
     }
 }
 
-//virtual
 void GraphicsSceneRectMove::keyPressEvent(QKeyEvent * keyEvent)
 {
     if (m_selectedItem == NULL) {
@@ -117,14 +116,18 @@ void GraphicsSceneRectMove::keyPressEvent(QKeyEvent * keyEvent)
     emit actionFinished();
 }
 
-//virtual
 void GraphicsSceneRectMove::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* e)
 {
     QPointF p = e->scenePos();
     p += QPoint(-2, -2);
     m_resizeMode = NoResize;
     m_selectedItem = NULL;
-    QGraphicsItem* g = items(QRectF(p , QSizeF(4, 4)).toRect()).at(0);
+
+    // http://www.kdenlive.org/mantis/view.php?id=1035
+    QList<QGraphicsItem*> i = items(QRectF(p , QSizeF(4, 4)).toRect());
+    if (i.size() <= 0) return;
+
+    QGraphicsItem* g = i.at(0);
     if (g) {
         if (g->type() == 8) {
             QGraphicsTextItem *t = static_cast<QGraphicsTextItem *>(g);
@@ -267,7 +270,6 @@ void GraphicsSceneRectMove::clearTextSelection()
     clearSelection();
 }
 
-//virtual
 void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e)
 {
     if ((e->screenPos() - m_clickPoint).manhattanLength() < QApplication::startDragDistance()) {
@@ -461,9 +463,9 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e)
                 QPainterPath mouseArea;
                 mouseArea.addRect(e->scenePos().toPoint().x() - 4 / m_zoom, e->scenePos().toPoint().y() - 4 / m_zoom, 8 / m_zoom, 8 / m_zoom);
                 // Check for collisions between the mouse and the borders
-                if (borderLeft.collidesWithPath(mouseArea) && borderTop.collidesWithPath(mouseArea) || borderRight.collidesWithPath(mouseArea) && borderBottom.collidesWithPath(mouseArea))
+                if ((borderLeft.collidesWithPath(mouseArea) && borderTop.collidesWithPath(mouseArea)) || (borderRight.collidesWithPath(mouseArea) && borderBottom.collidesWithPath(mouseArea)))
                     setResizeCursor(borderLeft.line().angle() - 45);
-                else if (borderLeft.collidesWithPath(mouseArea) && borderBottom.collidesWithPath(mouseArea) || borderRight.collidesWithPath(mouseArea) && borderTop.collidesWithPath(mouseArea))
+                else if ((borderLeft.collidesWithPath(mouseArea) && borderBottom.collidesWithPath(mouseArea)) || (borderRight.collidesWithPath(mouseArea) && borderTop.collidesWithPath(mouseArea)))
                     setResizeCursor(borderLeft.line().angle() + 45);
                 else if (borderLeft.collidesWithPath(mouseArea) || borderRight.collidesWithPath(mouseArea))
                     setResizeCursor(borderLeft.line().angle());