Qt miss resources after deploying - qt

I have simple Qt program. I have figured out how to use macdeployqt for deploying my app on macbooks without qt installed. But after installation from dmg (it is created using macdeployqt with -dmg option) no resources are displayed.
I added resources to project like this
It displays correctly if I simply put the app bundle from build to my program folder, but it is missing after deploying. What have I done wrong?

Related

Can't launch Qt Quick Controls application

I downloaded Qt 5.4 and created Qt Quick application with Qt Quick Controls 1.3.
I didn't change anything in code, just built it (as release). Then I copied .exe to another folder, added all the .dll files I needed and when I launched my program there was no window, just the program process running in the Task manager.
However, I can launch program which uses QtQuick 1.1.
How can I fix it?
Thanks.
Here is an image for some more explanation:
Try to deploy your application using The Windows Deployment Tool which copies all DLL and other files necessary for deployment alongside your application executable automatically.
The Windows Deployment Tool could be found in QTDIR/bin/windeployqt.exe
Open your command prompt and add the path to your Qt directory and it's bin folder to the PATH variable like :
set PATH= path\to\Qt\bin
Next run the windows deployment tool with your application path as the argument:
windeployqt.exe <path-to-app-binary>
This way you make sure that the deployed application would work on any computer and you have included whatever necessary.
Sounds like you are missing the platform plugin. It should be in the folder of the executable, in a platforms subfolder. That's why you aren't getting a window - the runtime fails to load the platform support plugin. On windows that should be a qwindows.dll file.

Cannot deploy my Quick 2 app to a Windows system without Qt installed

I am using Qt 5 with Visual Studio compiler. I have a Quick 2 application with a c++ backend.
I have bundled together my exe, a bunch of dll files, and all of the plugins from Qt, into a single folder. When I run the exe in this folder on a system with Qt installed but Qt Creator closed, it runs fine. When I run it on a system without Qt installed, it does not crash, but it just opens a small 1-inch square window that is all white, nothing else.
I am using a Qt resource file for the QML, so there are no standalone QML files that could be getting missed by the exe. Again, it runs fine on a system with Qt, so what else could I be missing? Dependency walker does not report any problems.
Here is what is in my app directory:
I've been looking at this for hours and I cannot understand what I must be missing (or why Windows deployment is so challenging with Qt).
The problem was resolved by also adding these directories:

QT: Can't deploy JPEG capability onto fresh windows machine

Jpegs are fine on my developer machine, but are not supported when i deploy my application to a fresh machine. all jpeg files used in stylesheets are still built with the application's resources, but are never displayed.
I tried deploying an "imageformats" folder, child of the executable folder, containing a "qjpeg4.dll" inside.
I tried linking against the qjpeg4.lib in my .pro file, WITH what's specified above.
still no good. Is there something in code I need to specify?
You need to deploy qt plugins with your application. Deploying Qt apps on Windows
This is just a guess, but I'm wondering if there is some dependency of the plugin that cannot be resolved on the virtual machine. Like you said, it is a simple file/folder thing, so it is probably finding the plugin dll. But maybe the dll is failing to load because it cannot resolve one if its dependencies.
The most likely culprit would be the C++ runtimes. Are you deploying those side-by-side in the application directory, or installed via the redistributable? If the former, the plugin may not be able to find them since it is in a different directory. To track this down, you could use the "Dependency Walker" and "SxSTrace.exe" tools.

Qt and Qt application prerequisites

I am new to Qt, and I am working in Windows 7.
When I try to run my application directly, I see an error about missing some DLLs. I tried to fix them, but I could not (I tried to build statically).
Is there any correct solution?
My question is:
If I want to run my Qt application on other computers, what do I need? For example, for a .NET application we need to install the .NET framework on the target computer, but what about for Qt?
I searched for its SDK and found a SDK that was about 1.6 GB! Does this mean every time I want to install my application I should install a 1.6 GB sized SDK? That's far too bad.
Thanks.
You have to distribute your application with needed libraries.
If your application is running on Windows you can follow this guide: Deploying an Application on Windows. You can find needed libraries as dll in bin directory inside SDK. A basic Qt gui application needs at least QTCORE4.DLL, QTGUI4.DLL and, if you are using Qt Creator, MINGWM10.DLL. You can leave these libraries in the same directory as you application.
You can't link statically against Qt unless you have built the libraries in that configuration (which you won't if you've just downloaded the pre-built SDK). Be aware that if you do want to link statically there are licensing implications for some components.
If you have built a release configuration then you will need at least the libraries Alessandro mentioned, QtCore4.dll and QtGui4.dll. Depending on the other parts of the library you're using you may also need QtXml4.dll QtWebkit4.dll, QtXmlPatterns4.dll and possibly Phonon.dll. Check that you are building a release configuration rather than a debug configuration, as this won't run as it needs the Visual Studio debug runtimes, which you can't redistribute. If you are in doubt which dlls you need then use DependencyWalker to find out (note that this doesn't show Phonon.dll as it is loaded later).
Generally you'll only need about 4-6 of the dlls, you won't need the whole SDK.
Please consider that many applications use Qt, you have some real chance the DLLs are already installed. Anyway, beware of MSVC dependencies: we had some real nightmare deploying applications on some server, partly related to a policy switch from VS2005 to VS2008. Alessandro already given a good resource: see also this previous post.
If you're working with Qt5, besides the .dlls mentioned by the first answer, you must also add the platforms/ folder from the bin directory inside the SDK.

Qt Deployment for Mac, configuring executable inside bundle

I was previously stuck on trying to build a Qt project that held the Qt libraries in the app bundle. I noticed the problem was that the executable inside the MacOS directory did not have execute permissions. Is there any way configure the build where the executable in the MacOS folder contains execute permissions by default?
You generally never care about exe permission when you build your exec from QtCreator. The main problem is attach all Qt frameworks for mac in your app bundle(solve by macdeployqt)
If you try to recompile from scratch you app, do you have always the same permission problem ?

Resources