Commit 91b268c2 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix title clip items need to be selected twice before allowing move

parent 323903cc
...@@ -656,7 +656,6 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e) ...@@ -656,7 +656,6 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e)
viewlist.first()->setRubberBandSelectionMode(Qt::IntersectsItemShape); viewlist.first()->setRubberBandSelectionMode(Qt::IntersectsItemShape);
} }
} }
QList<QGraphicsItem *> selected = selectedItems();
bool alreadySelected = false; bool alreadySelected = false;
foreach(QGraphicsItem *g, list) { foreach(QGraphicsItem *g, list) {
//qDebug() << " - - CHECKING ITEM Z:" << g->zValue() << ", TYPE: " << g->type(); //qDebug() << " - - CHECKING ITEM Z:" << g->zValue() << ", TYPE: " << g->type();
...@@ -673,7 +672,10 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e) ...@@ -673,7 +672,10 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e)
} }
if (item == NULL || (e->modifiers() != Qt::ShiftModifier && !alreadySelected)) { if (item == NULL || (e->modifiers() != Qt::ShiftModifier && !alreadySelected)) {
clearTextSelection(); clearTextSelection();
} else if (item && item->flags() & QGraphicsItem::ItemIsMovable) { } else if (e->modifiers() & Qt::ShiftModifier) {
clearTextSelection(false);
}
if (item && item->flags() & QGraphicsItem::ItemIsMovable) {
m_sceneClickPoint = e->scenePos(); m_sceneClickPoint = e->scenePos();
m_selectedItem = item; m_selectedItem = item;
//qDebug() << "///////// ITEM TYPE: " << item->type(); //qDebug() << "///////// ITEM TYPE: " << item->type();
...@@ -743,7 +745,7 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e) ...@@ -743,7 +745,7 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e)
//qDebug() << "////// MOUSE CLICK, RESIZE MODE: " << m_resizeMode; //qDebug() << "////// MOUSE CLICK, RESIZE MODE: " << m_resizeMode;
} }
void GraphicsSceneRectMove::clearTextSelection() void GraphicsSceneRectMove::clearTextSelection(bool reset)
{ {
if (m_selectedItem && m_selectedItem->type() == QGraphicsTextItem::Type) { if (m_selectedItem && m_selectedItem->type() == QGraphicsTextItem::Type) {
// disable text editing // disable text editing
...@@ -754,7 +756,9 @@ void GraphicsSceneRectMove::clearTextSelection() ...@@ -754,7 +756,9 @@ void GraphicsSceneRectMove::clearTextSelection()
t->setTextInteractionFlags(Qt::NoTextInteraction); t->setTextInteractionFlags(Qt::NoTextInteraction);
} }
m_selectedItem = NULL; m_selectedItem = NULL;
clearSelection(); if (reset) {
clearSelection();
}
} }
void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e) void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e)
...@@ -776,7 +780,6 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e) ...@@ -776,7 +780,6 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e)
if (e->buttons() != Qt::NoButton && !m_moveStarted) { if (e->buttons() != Qt::NoButton && !m_moveStarted) {
if ((view->mapFromScene(e->scenePos()) - view->mapFromScene(m_clickPoint)).manhattanLength() < QApplication::startDragDistance()) { if ((view->mapFromScene(e->scenePos()) - view->mapFromScene(m_clickPoint)).manhattanLength() < QApplication::startDragDistance()) {
e->ignore(); e->ignore();
QGraphicsScene::mouseMoveEvent(e);
return; return;
} else { } else {
m_moveStarted = true; m_moveStarted = true;
......
...@@ -118,7 +118,8 @@ public: ...@@ -118,7 +118,8 @@ public:
void setZoom(double s); void setZoom(double s);
void setTool(TITLETOOL tool); void setTool(TITLETOOL tool);
TITLETOOL tool() const; TITLETOOL tool() const;
void clearTextSelection(); /** @brief Get out of text edit mode. If reset is true, we also unselect all items */
void clearTextSelection(bool reset = true);
int gridSize() const; int gridSize() const;
void addNewItem(QGraphicsItem *item); void addNewItem(QGraphicsItem *item);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment