I have a table view with the following selection settings:
setSelectionBehavior(QAbstractItemView::SelectRows);
setSelectionMode(QAbstractItemView::ExtendedSelection);
This way I can select several rows by clicking and hovering left mouse button.
However this behavior conflicts with dragging and dropping, that’s what we see for example in Windows Explorer.
I want to allow users to select rows with right mouse button, and drag’n’drop them with their left mouse button (like in Total Commander).
How can I do that?
If you haven’t already, subclass whatever built-in table view you are using (probably
QTableView), and reimplementmousePressEvent(QMouseEvent* event)andmouseReleaseEvent(QMouseEvent* event)to modify the current selection.