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)
viewlist.first()->setRubberBandSelectionMode(Qt::IntersectsItemShape);
}
}
QList<QGraphicsItem *> selected = selectedItems();
bool alreadySelected = false;
foreach(QGraphicsItem *g, list) {
//qDebug() << " - - CHECKING ITEM Z:" << g->zValue() << ", TYPE: " << g->type();
......@@ -673,7 +672,10 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e)
}
if (item == NULL || (e->modifiers() != Qt::ShiftModifier && !alreadySelected)) {
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_selectedItem = item;
//qDebug() << "///////// ITEM TYPE: " << item->type();
......@@ -743,7 +745,7 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e)
//qDebug() << "////// MOUSE CLICK, RESIZE MODE: " << m_resizeMode;
}
void GraphicsSceneRectMove::clearTextSelection()
void GraphicsSceneRectMove::clearTextSelection(bool reset)
{
if (m_selectedItem && m_selectedItem->type() == QGraphicsTextItem::Type) {
// disable text editing
......@@ -754,7 +756,9 @@ void GraphicsSceneRectMove::clearTextSelection()
t->setTextInteractionFlags(Qt::NoTextInteraction);
}
m_selectedItem = NULL;
clearSelection();
if (reset) {
clearSelection();
}
}
void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e)
......@@ -776,7 +780,6 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent* e)
if (e->buttons() != Qt::NoButton && !m_moveStarted) {
if ((view->mapFromScene(e->scenePos()) - view->mapFromScene(m_clickPoint)).manhattanLength() < QApplication::startDragDistance()) {
e->ignore();
QGraphicsScene::mouseMoveEvent(e);
return;
} else {
m_moveStarted = true;
......
......@@ -118,7 +118,8 @@ public:
void setZoom(double s);
void setTool(TITLETOOL tool);
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;
void addNewItem(QGraphicsItem *item);
......
Markdown is supported
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