Re: Drag from QListWidget
Quote:
Originally Posted by
Pradeep V
Code:
{
my_text = Event->mimeData()->text();
mimeData->setText(my_text);
drag->setMimeData(mimeData);
drag->exec();
}
Why do you want to start a drag when a drag enters the widget?
Wouldn't it be better to handle the incoming drag?
Quote:
Originally Posted by
Pradeep V
But in the dropEvent function, when i capture the mimedata, it is of "application/x-qabstractitemmodeldatalist" format.
That's what a QAbstractItemView based view class will use.
Cheers,
_
Re: Drag from QListWidget
I am very much new to Qt.. Can you elaborate more so that i can understand better.
Re: Drag from QListWidget
Quote:
Originally Posted by
Pradeep V
I am very much new to Qt.. Can you elaborate more so that i can understand better.
The default implementation of QAbstractItemView::startDrag() calls the model's mimeData() method to fill the drag object.
The default implementation of that uses the MIME type you see and encodes the data such that it or another instance of it can decode it again.
You can look at the model's code, or implement your own mimeData() or implement your own startDrag() to encode the data differently.
Ah, you wrote QListWidget: in this case you can overwrite its mimeTypes() an mimeData() methods to encode the data the way you want.
Cheers,
_