Qt drag/drop: cannot move when copy is enabled (Ubuntu Gnome)
Posted
by
Scott
on Stack Overflow
See other posts from Stack Overflow
or by Scott
Published on 2012-07-04T03:14:24Z
Indexed on
2012/07/04
3:15 UTC
Read the original article
Hit count: 105
I'm implementing a view and a model where I want to support both moving items internally (by dragging), and copying items (by pressing Ctrl while dragging). I've done everything I need to do according to the instructions. I've set up the mime functions, I've implemented removeRows(), and flags(). The problem is when I drag, it defaults to a copy operation (I get the arrow cursor with a plus sign, and it indeed copies the item by creating a new one in the model).
The only difference I can see is this: If I return only Qt::MoveAction in supportedDropActions(), it only moves. If I return (Qt::CopyAction | Qt::MoveAction), it only copies.
Any ideas? I want it to work like files in Nautilus (Gnome) or Windows file Explorer: drag moves icons around, ctrl+drag copies them.
© Stack Overflow or respective owner