My solution was the following (I subclassed views) :
{
QModelIndexList liste=selectedIndexes();
QMimeData *mimeData
= model
()->mimeData
(liste
);
drag->setMimeData(mimeData);
drag->setHotSpot(event->pos() - rect().topLeft());
Qt::DropAction dropAction = drag->start( Qt::MoveAction);
if (dropAction == Qt::MoveAction) {
model()->removeRows(liste[0].row(),liste.size(),liste[0].parent());
}
}
void viewSource::mouseMoveEvent(QMouseEvent *event)
{
QModelIndexList liste=selectedIndexes();
QMimeData *mimeData = model()->mimeData(liste);
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->setHotSpot(event->pos() - rect().topLeft());
Qt::DropAction dropAction = drag->start( Qt::MoveAction);
if (dropAction == Qt::MoveAction) {
model()->removeRows(liste[0].row(),liste.size(),liste[0].parent());
}
}
To copy to clipboard, switch view to plain text mode
and :
void viewTarget
::dropEvent(QDropEvent *e
) //viewTarget subclassed QListView {
e->setDropAction(Qt::MoveAction);
e->accept();
}
void viewTarget::dropEvent(QDropEvent *e) //viewTarget subclassed QListView
{
QListView::dropEvent(e);
e->setDropAction(Qt::MoveAction);
e->accept();
}
To copy to clipboard, switch view to plain text mode
I think it will remind you sth wysota
Thanks for all
Bookmarks