Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, February 2007
Re: Image Drag/Drop on Windows


Message 1 in thread

Thanks,

P.S. On other lists I just replied to the email and it is sent back to 
the list. For this reply I reset the "TO" to qt-interest.   Did you have 
to redirect your first reply to me back to the list?  Does this list 
work differently than most?

Andreas Pakulat wrote:
> On 31.01.07 13:54:05, Mike Adolf wrote:
>   
>> Just as a follow up on the solution, using
>>     
>
> Please don't send me private mails, send them to the list so others can
> benefit.
>
>   
>>    QStringList qsl = event->mimeData()->formats();
>> I found that the mime type is text/uri-list, which has "hasUrls()" as the check 
>> and urls() as the getter.
>>
>> However, when getting the list of urls using
>>    QList<QUrl> list = event->mimeData()->urls();
>> and converting to a qstring path using
>>    list.at(0).path();
>> I was forced to append .remove(0,1) since the url as returned had a leading "/" 
>> (a linux root ??)
>>    /(real absolute window's path)
>>     
>
> That is because the path of a URL is different from a filesystem path.
>
>   
>> Then the image loaded and displayed fine.
>>
>> I used image.load(QString) which requires the path.  I did not know how to use 
>> the url directly.
>> I could still be doing something wrong, but this doesn't seem to be very 
>> portable!
>>     
>
> The portable way would be to use toLocalFile instead of path on the URL,
> thats how you get the operating system dependant path to the image.
>
> Andreas
>
>   

--
 [ signature omitted ]