Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, December 2006
[Qt4] Doing copy vs. move/overwrite with item-based views


Message 1 in thread

The docs for drag-and-drop with QListWidget and QTreeWidget say
that if you enable DnD with something like the following:

    QListWidget *listWidget = new QListWidget(this);
    listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
    listWidget->setDragEnabled(true);
    listWidget->setAcceptDrops(true);
    listWidget->setDropIndicatorShown(true);

Then the behavior is:
"The result is a list widget which allows the items to be copied around 
within the view, and even lets the user drag items between views
containing 
the same type of data. In both situations, the items are copied rather
than moved."

However, when I did a simple example based on the above, items were
moved/overwritten rather than copied.  How do you control if a DnD
does a move/overwrite or a copy?  I assume you have to start overriding
stuff like startDrag(), dragEnterEvent(), dragMoveEvent(), dropEvent(),
etc?


== Rich
 

--
 [ signature omitted ]