Drag and drop event->mimeData()->hasImage() return false , when droping image file
i like to build simple listView that support dropping images . simple.
this listview is added to to QDialog , when i implement the QDialog dropEvent
and try to check if the drop image is image . according to example i should first see if the data hasImage
but the event->mimeData()->hasImage() always returns me false, why ?
Where are you dropping the image from?
If it's from a file manager it could be possible that it's just dropping the URL to the file itself, although the DND has a image thumbnail. Just dump the QMimeData and analyze its contents.
How do you drag/drop the image?
Do you select a file and try to drop that? Then you get an Url and have to check the file.
Or do you select some image like in word and drop that?
For checking what is dumped, you can use the "dropsite example":http://doc.qt.nokia.com/4.7/draganddrop-dropsite.html
its from file manager , so i guess i need to check if its valid file suffix
like jpd,png .... or there is more generic way ?
That's the way, check the type URL and the check the file type. You could also use a QImage or similar and try loading it :-)