Polnareff
1st June 2010, 19:55
Hi,
I've overridden the functions dragEnterEvent and dropEvent for a class which inherits from QTableWidget. This class is set to accept drops, and I have an instance of it in my main form.
First, in my dragEnterEvent, I'd like to check that the file is of mp3 format. I tried with the following:
if (event->mimeData()->hasFormat(QLatin1String("audio/mpeg")))
But this always seems to fail. In fact, no format has worked thus far, and I'm not sure why. Is there something I'm missing or doing wrong?
I then decided that as an alternative method, I'd get the file name and extract the file format myself. My question here is how exactly I can retrieve either the File object itself, or just the filename from within these functions (I assume somehow from the QDragEnterEvent and QDropEvent).
Thanks :)
I've overridden the functions dragEnterEvent and dropEvent for a class which inherits from QTableWidget. This class is set to accept drops, and I have an instance of it in my main form.
First, in my dragEnterEvent, I'd like to check that the file is of mp3 format. I tried with the following:
if (event->mimeData()->hasFormat(QLatin1String("audio/mpeg")))
But this always seems to fail. In fact, no format has worked thus far, and I'm not sure why. Is there something I'm missing or doing wrong?
I then decided that as an alternative method, I'd get the file name and extract the file format myself. My question here is how exactly I can retrieve either the File object itself, or just the filename from within these functions (I assume somehow from the QDragEnterEvent and QDropEvent).
Thanks :)