PDA

View Full Version : Load gif into QMovie by QPluginLoader



cia.michele
27th May 2013, 17:01
Hello to everybody :)

I'm a newbie with Qt and I've a small problem!

I'd show an animated Gif on my QDialog: I saw that I need QMovie, so I can run the animation. So I've write this:

QMovie *movie = new QMovie(":/Immagini/bar.gif");
All run good on my development machine, but If I move my executable I don't see the image!!

I search about it, and I find that I need to port the qgif4.dll plugin, so, how can I do this?

I know a code to use an SQLPlugin, as:

QPluginLoader loader("qsqlodbc4.dll");
QObject *plugin = loader.instance();

if (!plugin)
return;

QSqlDriverPlugin *sqlPlugin = qobject_cast<QSqlDriverPlugin *>(plugin);

if (!sqlPlugin ) {
QMessageBox::warning(0, "SQL plugin", "Loading failed", QMessageBox::Ok);
}

db = QSqlDatabase::addDatabase(sqlPlugin->create("QODBC"));

Is there any similar code? Which is the PluginClas? QImageIOPlugin? How can I use it?

Thanks a lot for your time.

Michele

wysota
27th May 2013, 17:22
http://www.qtcentre.org/faq.php?faq=qt_images#faq_qt_missing_images

cia.michele
28th May 2013, 11:01
Thanks wysota,
but... It's the only way? I need to copy the imageformats folder into my root folder? I tried it and it run but... Is there any solution to use only dll into my root directory (as sqlplugin) without use the imagefolders directory?

The directories could be accessed by the users, and I worry about they can modifie it...

Thanks for your time

Michele

wysota
28th May 2013, 11:52
but... It's the only way?
It's the simplest way.


Is there any solution to use only dll into my root directory (as sqlplugin) without use the imagefolders directory?
You can add the plugin code directly to your project if you really want to but that's usually a bad idea.


The directories could be accessed by the users, and I worry about they can modifie it...
Aren't you worried they can modify your Qt dlls?