Hi,
I have a custom Treeview with a QFilemodel attached to it.
The reason for making it custom is to be able to handel drag and drop myself.
All I wanted to archiev is to get rid of the Pixmap that is taken from the draged Treeview Item.
setPixmap does work if I set the mimeData myself.
The Problem is to get the right Index for the mime Data.
I tired:
QModelIndexList tempindexlist;
tempindexlist.append(selectedIndexes());
Drag.setMimeData(model()->mimeData(tempindexlist));
QModelIndexList tempindexlist;
tempindexlist.append(selectedIndexes());
Drag.setMimeData(model()->mimeData(tempindexlist));
To copy to clipboard, switch view to plain text mode
wich woks if I select the Item to be draged first. So I have to explicitly click on an Item first befor draging it.
If I just drag it out of the treevie without clicking it previously, the indexlist contains the last selected index (or nothing if there is no selection).
then I tried it this way:
QModelIndexList tempindexlist;
tempindexlist.append(currentIndex());
QModelIndexList tempindexlist;
tempindexlist.append(currentIndex());
To copy to clipboard, switch view to plain text mode
but this behaves exactly the same way.
If I don't set the mimeData it works, but then the Pixmap is set automatically and i can't change it.
Is there an equivalent of selectedIndexes for draged indexes?
Any other way to solve this?
Bookmarks