QMovie doesn't show GIF file in Mac - qt

In my project, I use QMovie as a loading bar. It works well in Windows. However, I moved my project to Mac and it didn't work anymore.
The GIF image file is in the resource file. I tried using both resource file path and absolute file path. But, it seems not okay.
Thanks

Gif capacity is done with a plugin. Your application needs to be able to load qgif4 plugin at runtime to be able to display gif
=> make sure your gif imageformat plugin is compiled, deployed and in your application library path (note that these paths can be checked at runtime using QCoreApplication::libraryPaths

I used QPaintEvent and QRect to show loading animation. Now, the problem was solved by following MoviePlayer example of Qt using QLabel::setMovie function.

Related

C++ Qt - QPixmap does not load with Qt Creator, but load when run via terminal

I am coding a GUI using Qt. When I run the application using QtCreator, my images do not load, and I receive the following error:
QPixmap::scaled: Pixmap is a null pixmap
Yet, when I run the application via command line, everything displays perfectly.
Why so? And how can I get QtCreator to load my images properly?
NB: Those images are barely 20ko each, so what I read about images being too big can't apply.
EDIT: A typical filename is 'Images/Cards/Base/card01.jpg', where Images is a subdirectory of my project directory (the code being at the root)
If you are working with images that should be bundled with the application, such as icons, then you should try and make use of the Qt Resource system.
This allows you to build the resources into the actual project and reference them in a filesystem independent syntax. i.e.: :/icons/myIcon.png
Most likely you have a difference between the relative location of the file in Qt Creator vs the command line.

QML - Images don't load in deployed version of application

I wrote a Qt/QML application and every thing is OK during compile time and running on my own system. But when I move this software to an another computer none of pictures loads.
for example here is my background picture:
Image{
id:background;
source:"qrc:/qml/MobnaPC/images/back.jpg"
}
this image loads when I run the executable file ( which is created in release mode ) in my system ( development environment system ) but when I move this file and its associated dlls to another system( without Qt installed) the background image doesn't load.
I also tried relative addressing instead of resource system. but the problem remained. How can I solve this strange behavior?
You are missing the Qt plugins that handle JPEG image formats. The simplest way to solve this is to copy the qjpeg4.dll into the same working directory as your executable.

QT Webview url loading

Mine is a somple application,I am just loading a url page(loading from server) in the widget window.
Ex:
QWebView->load(QUrl("xxxxx"));
QWebView->show();
this url contains some jpeg image and javascript.
The problem here is my application is able to page correctly in some machines but in some machines jpeg image is not able to load.
Please help me to resolve this issue. I am just surprised what could be the reason.
If you're working with an SDK build of Qt, the ability to view JPEGs in a Qt application is based on the JPEG plugin.
Please see one of the following links:
http://developer.qt.nokia.com/doc/qt-4.8/deployment.html
http://developer.qt.nokia.com/doc/qt-4.8/deployment-plugins.html
Alternatively, if you are building from source, you can compile JPEG support into Qt itself.

QPixmap image loading problem

Basically I am trying to load the image as a texture using QPixmap:
texture[T_WALL] = bindTexture(QPixmap(":/images/wall.png"), GL_TEXTURE_2D);
The code works on my development machine, but not in the vm / other pcs without QT. Initially I was using jpegs and just assumed that I messed up the plugins, but as I understand, no plugins are needed for png files so I have no idea where the problem is.
Results are the same when loading local files and using Qt resources.
I am deploying libgcc_s_dw2-1.ddl, mingwm10.dll, QtCore4.dll, QtGui4.dll, QtOpenGL4.dll. Do I need anything else?
Try adding an imageformats directory to your application directory and put qmng4.dll there. See my answer to the question Qt dll deployment on windows
If it still does not work, get the Sysinternals suite which contains dgbview.exe that allows you to watch qDebug messages (even for release builds).

Qt deploying qgif4.dll plugin for QMovie

I'm having problems with deploying an application on Windows that displays an animated gif. For this purpose I use a QMovie and it works fine if I launch it from QtCreator. I gathered the files that are needed to run the application, and I can launch it just fine, but the gif won't show up.
I read this page and came to the conclusion that I need to add the qgif4.dll plugin which is located in qt/bin/plugins/imageformats. I tried copying it into a plugins folder next to the application, also plugins/imageformats, but it still doesn't work. I also tried to
QApplication::addLibraryPath(QDir::currentPath());
and copy the qgif4.dll file next to my executable - without any success. How do I fix this?
Put it in ./imageformats, relative to the executable.

Resources