Custom pixmap and dynamic cursor while dragging item from QListView
-
How can I achieve these 2 things while dragging an item from QListView:
- I'd like to use custom pixmap instead of provided by default (which is just a copy of my item)
- Also I'd like to change cursor with one of my own, depending on possibility of underlying area to accept dragged item.
-
Hi,
In order to use custom pixmap while dragging you can have a look in "QDrag::setPixmap()":http://doc.qt.nokia.com/4.7-snapshot/qdrag.html#setPixmap. You can write something like
@QDrag *drag = new QDrag(this);
drag->setMimeData(/mimeData/);
drag->setHotSpot(/location/);
drag->setPixmap(/pixmap/));@in startDrag() event or mousePressEvent() whichever you are using.