Update current item and anchor item on mouse clicks

This commit is contained in:
Frank Reininghaus 2011-08-03 00:35:03 +02:00
parent 71ccc7e361
commit 3547357862

View file

@ -131,10 +131,17 @@ bool KItemListController::inputMethodEvent(QInputMethodEvent* event)
bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform)
{
Q_UNUSED(event);
Q_UNUSED(transform);
const QPointF pos = transform.map(event->pos());
m_pressedIndex = m_view->itemAt(pos);
m_selectionManager->setCurrentItem(m_pressedIndex);
// The anchor for the current selection is updated except for Shift+LeftButton events
// (the current selection is continued with the previous anchor in that case).
if (!(event->buttons() & Qt::LeftButton && event->modifiers() & Qt::ShiftModifier)) {
m_selectionManager->setAnchorItem(m_pressedIndex);
}
return false;
}