PDA

View Full Version : Initiate file download on drag from between models



psih128
13th March 2009, 23:42
Hi

In my application I have two views, one shows Local QDirModel, the other shows my custom Remote model presenting a bunch of files, downloadable from internet - each file in the model has a corresponding download link.

Now I want to be able to grab an item from the view presenting the Remote model and drop in in the view presenting the Local model. On this event I want to download the remote file and save it locally in the corresponding folder.

What is the most appropriate way to implement this?

Should I subclass QDirModel and reimplement QAbstractItemModel::dropMimeData? Or is there another, nicer way to accomplish this?

Thanks
Anton

psih128
15th March 2009, 14:39
I'm sorry for impatience, but is it something complicated?

wysota
15th March 2009, 21:03
Yes, you should reimplement dropMimeData. This might come in handy as well: Extended Dir View example.