PDA

View Full Version : Show Gif from url with QMovie



madlymad
6th July 2010, 14:18
Hi I'm quite new to qt and I'm trying to show an animated gif from an internet url to my mobile application.


QByteArray ba = SyncHTTP::requestImg( QUrl(strUrl) );
QBuffer * data = new QBuffer(&ba);
QMovie *gif = new QMovie(data);
ui->myLabel->setMovie(gif);
gif->start();

where SyncHTTP::requestImg( QUrl(strUrl) ); returns a ByteArray of my gif image. (works fine with an other static image)

the image is appearing fine but when it's time for the next frame of the gif the program crash. I understand that the problem has to do something with destroying objects, but as I'm not experienced in C++ cannot figure it out...

Any idea? or other way of implementing it?

hicham
12th November 2010, 15:56
QByteArray *ba= new QByteArray(SyncHTTP::requestImg( QUrl(strUrl));