}
}
-//virtual
void GraphicsSceneRectMove::keyPressEvent(QKeyEvent * keyEvent)
{
- if (m_selectedItem == NULL) {
+ if (m_selectedItem == NULL || !(m_selectedItem->flags() & QGraphicsItem::ItemIsMovable)) {
QGraphicsScene::keyPressEvent(keyEvent);
return;
}
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);
break;
}
}
- if (item == NULL) {
+ if (item == NULL || !(item->flags() & QGraphicsItem::ItemIsSelectable)) {
if (m_selectedItem && m_selectedItem->type() == 8) {
// disable text editing
QGraphicsTextItem *t = static_cast<QGraphicsTextItem *>(m_selectedItem);
}
}
}
- if (item != NULL) {
+ if (item != NULL && item->flags() & QGraphicsItem::ItemIsMovable) {
m_sceneClickPoint = e->scenePos();
m_selectedItem = item;
kDebug() << "///////// ITEM TYPE: " << item->type();
clearSelection();
}
-//virtual
void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e)
{
if ((e->screenPos() - m_clickPoint).manhattanLength() < QApplication::startDragDistance()) {
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());