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?
如果还没有,请子类化您正在使用的任何内置表视图(可能是QTableView
),并重新实现mousePressEvent(QMouseEvent* event)
和mouseReleaseEvent(QMouseEvent* event)
来修改当前选择。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.