I think the easiest way to do this is to create a derived class from a QListView, and then override its mouseMoveEvent function. This function in the Qt code for QListView looks for the drag state and creates a rectangle. I think something like this might work, but I have not tested it:
void DerivedListView::mouseMoveEvent(QMouseEvent *e) {
if (state() != DragSelectingState)
QListView::mouseMoveEvent(e);
}
source
share