From: Frank Reininghaus Date: Tue, 2 Aug 2011 22:35:03 +0000 (+0200) Subject: Update current item and anchor item on mouse clicks X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/354735786254d13a4df487d9fbd135384ae6c434 Update current item and anchor item on mouse clicks --- diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 91fb86806..b58ddfae6 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -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; }