const bool shiftPressed = event->modifiers() & Qt::ShiftModifier;
const bool controlPressed = event->modifiers() & Qt::ControlModifier;
const bool shiftOrControlPressed = shiftPressed || controlPressed;
+ const bool navigationPressed = key == Qt::Key_Home || key == Qt::Key_End ||
+ key == Qt::Key_PageUp || key == Qt::Key_PageDown ||
+ key == Qt::Key_Up || key == Qt::Key_Down ||
+ key == Qt::Key_Left || key == Qt::Key_Right;
const int itemCount = m_model->count();
}
}
- const bool selectSingleItem = m_selectionBehavior != NoSelection &&
- itemCount == 1 &&
- (key == Qt::Key_Home || key == Qt::Key_End ||
- key == Qt::Key_Up || key == Qt::Key_Down ||
- key == Qt::Key_Left || key == Qt::Key_Right);
+ const bool selectSingleItem = m_selectionBehavior != NoSelection && itemCount == 1 && navigationPressed;
+
if (selectSingleItem) {
const int current = m_selectionManager->currentItem();
m_selectionManager->setSelected(current);
}
break;
}
+ }
+ if (navigationPressed) {
m_view->scrollToItem(index);
}
return true;
m_selectionManager->endAnchoredSelection();
}
+ if (event->buttons() & Qt::RightButton) {
+ // Stop rubber band from persisting after right-clicks
+ KItemListRubberBand* rubberBand = m_view->rubberBand();
+ if (rubberBand->isActive()) {
+ disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged);
+ rubberBand->setActive(false);
+ m_view->setAutoScroll(false);
+ }
+ }
+
if (m_pressedIndex >= 0) {
m_selectionManager->setCurrentItem(m_pressedIndex);