Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/kitemlistcontroller.cpp
Show First 20 Lines • Show All 528 Lines • ▼ Show 20 Line(s) | |||||
529 | } | 529 | } | ||
530 | 530 | | |||
531 | bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform) | 531 | bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform) | ||
532 | { | 532 | { | ||
533 | if (!m_view) { | 533 | if (!m_view) { | ||
534 | return false; | 534 | return false; | ||
535 | } | 535 | } | ||
536 | 536 | | |||
537 | m_pressedMousePos = transform.map(event->pos()); | 537 | m_pressedMousePos = transform.map(event->pos()); | ||
ngraham: Unrelated whitespace change | |||||
538 | m_pressedIndex = m_view->itemAt(m_pressedMousePos); | 538 | m_pressedIndex = m_view->itemAt(m_pressedMousePos); | ||
539 | emit mouseButtonPressed(m_pressedIndex, event->buttons()); | 539 | emit mouseButtonPressed(m_pressedIndex, event->buttons()); | ||
540 | 540 | | |||
541 | if (event->buttons() & (Qt::BackButton | Qt::ForwardButton)) { | 541 | if (event->buttons() & (Qt::BackButton | Qt::ForwardButton)) { | ||
542 | // Do not select items when clicking the back/forward buttons, see | 542 | // Do not select items when clicking the back/forward buttons, see | ||
543 | // https://bugs.kde.org/show_bug.cgi?id=327412. | 543 | // https://bugs.kde.org/show_bug.cgi?id=327412. | ||
544 | return true; | 544 | return true; | ||
545 | } | 545 | } | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 581 | } else if (pressedItemAlreadySelected && !shiftOrControlPressed && (event->buttons() & Qt::LeftButton)) { | |||
591 | } | 591 | } | ||
592 | } | 592 | } | ||
593 | 593 | | |||
594 | if (!shiftPressed) { | 594 | if (!shiftPressed) { | ||
595 | // Finish the anchored selection before the current index is changed | 595 | // Finish the anchored selection before the current index is changed | ||
596 | m_selectionManager->endAnchoredSelection(); | 596 | m_selectionManager->endAnchoredSelection(); | ||
597 | } | 597 | } | ||
598 | 598 | | |||
599 | if (event->buttons() & Qt::RightButton) { | ||||
600 | // Stop rubber band from persisting after right-clicks | ||||
601 | KItemListRubberBand* rubberBand = m_view->rubberBand(); | ||||
602 | if (rubberBand->isActive()) { | ||||
603 | disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged); | ||||
ngraham: KDE coding style: Open braces go on the same line as the `if` statement | |||||
604 | rubberBand->setActive(false); | ||||
elvisangelaccio: Please wrap this code within `if (rubberBand->isActive()) { ... }` | |||||
605 | m_view->setAutoScroll(false); | ||||
606 | } | ||||
607 | } | ||||
608 | | ||||
599 | if (m_pressedIndex >= 0) { | 609 | if (m_pressedIndex >= 0) { | ||
600 | m_selectionManager->setCurrentItem(m_pressedIndex); | 610 | m_selectionManager->setCurrentItem(m_pressedIndex); | ||
601 | 611 | | |||
602 | switch (m_selectionBehavior) { | 612 | switch (m_selectionBehavior) { | ||
603 | case NoSelection: | 613 | case NoSelection: | ||
604 | break; | 614 | break; | ||
605 | 615 | | |||
606 | case SingleSelection: | 616 | case SingleSelection: | ||
▲ Show 20 Lines • Show All 739 Lines • Show Last 20 Lines |
Unrelated whitespace change