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.
Related
I set a background image(JPEG) on a Qt widget using setStyleSheet(). This is perfectly shown on my computer, but not on another computer.
I am not getting a link error on the other computer -- the feature just doesn't work. Is there something I am missing in the distribution or build of my app, something that the Qt dev tools installs or is otherwise available, that isn't present on other machines? How can I distribute a Qt app that uses JPEG functionality?
JPEG support in Qt comes as a plugin. Make sure you have also deployed the plugin to your non-development machine. If you haven't, it will simply silently fail and you'll end up not seeing any of the JPEG images. Have a look at the official documentation for more detailed information: http://qt-project.org/doc/qt-4.8/deployment-windows.html
In short (and as a quick solution, but have a look at the documentation as well) you could create a directory named "imageformats" as a subdirectory of the folder containing your exe, into which you copy QJPEG4.dll.
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.
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).
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.
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.