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