Skip to content

qt: qml: implement rubber band selection

Fatih Uzunoğlu requested to merge fuzun/vlc:qml-rubberband_selector into master

Qt Quick is oriented towards touch screen, and it does not provide some features that are essential for desktop applications. One of these feature is rubber band selection, which allows multiple selection by dragging views.

This merge request implements a generic rubber band selection. It works by asynchronously checking child items if they are overlapped on the rectangle selection indicator.

It has O(n) complexity because of running through all items. This can be optimized for specific usages, such as list view 1. But this generic approach allows it to be used in other places, such as custom views. I propose it as is, with room for potential improvements.

Note: Obviously, it does not work on touch screen.

Fixes #25568.

simplescreenrecorder-2021-11-22_20.20.42

  1. https://code.woboq.org/qt5/qtbase/src/widgets/itemviews/qlistview.cpp.html#_ZN9QListView12setSelectionERK5QRect6QFlagsIN19QItemSelectionModel13SelectionFlagEE

Edited by Fatih Uzunoğlu

Merge request reports