Qt application on Windows - qt

So, I made a Qt application on Qt Creator that displays jpg files and mp3 files(using phonon).
On deploying the application with dynamic linked libraries I had to copy to the same folder QtCore4.dll, QtGui4.dll, phonon4.dll, mingwm10.dll and libgcc_s_dw2-1.dll as required by Windows.
The problem is that the jpg files and mp3 files are only shown on pcs with the QtSDK installed. In other pcs the exe file runs, opens the user interface and does everything right except showing jpg and mp3 files. The directory path is not the problem because it opens a pdfviewer that I put in the same folder. Do I need to provide other files?

Qt relies on plugins for most of the file formats. For Jpeg you will need to include the qjpeg4.dll found in the plugins/imageformats directory. For Phonon, you will also need to include the appropriate backend DLL found in the plugins/phonon_backend directory.
All the information you need is contained within the Qt documentation on Deploying an Application on Windows and especially the section on Qt Plugins.

Related

Javafx project deployment - how to handle assets/resources?

I recently finished my first JavaFX project and am ready for deployment. I found that when I create the jar file for my project my ide creates a folder with the jar and other necessary files. I noticed that when I run the jar in the file everything works fine. However, when I take the jar our of that folder and place it as a desktop icon, various resources no longer become available - I am assuming this is because the jar file and the various resource files are no longer in the same file path/folder. - Is this the correct assumption to make?
Regardless, I wanted to ask what is the standard method of getting JavaFX resources and the accompanying jar file to work when the resources are not located in the same folder?
Essentially, I want to have a clickable desktop icon that launches the app, which the jar file fulfills. But if I put that jar file in a folder with its resources to get the project to work properly then the user will have to press the folder and then the jar file in order to get the project to launch - which is very counterintuitive.
Any ideas on how this issue is handled?
The best way to do this is to create a shortcut to your jar file not copy it to another location. The jar file depends on these resources to execute especially if you used external libraries.
The other alternative would be to export your jar file with the libraries included in the jar. This however would make your jar very huge depending on the number of libraries you have.
I hope this helps.

Deploy QML application with localstorage plugin

I have deployed a QML application (static build on windows, following this how-to: http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW). However, the qml_import_trace (screenshot below) reveals that LocalStorage is loaded from the Qt/Static folder on the development computer, not from the release folder. Hence, when launched at another computer, the LocalStorage module is not found. How may the LocalStorage plugin/module be shipped with the application?
Including the following lines in the .pro files will give svg support. Am I only missing a qtplugin for sql/localstorage? In that case, what is the proper plugin name? Also, where can I find valid inputs for QTPLUGIN+= and QT+= ?
QTPLUGIN += qsvg
QT += svg sql
If I understand you correctly you want to copy the needed files to the release folder automatically.
Use the windeployqt.exe (in qt/bin folder) with --qmldir option. It will scan the given path for QML files and collect the QML components imported in those files.
A solution, although not optimal, was to manually copy the QtQuick/LocalStorage folder from the static folder into the release folder

Qt can't access some .dll files

I am working on a plugin for some application, and I am using libtiff. The filter is working just fine, but there is a problem. There are some .dll files that have to be included in compile path. When I add those .dlls in \QtSDK\Desktop\Qt\4.8.1\mingw\bin the plugin is working fine, but when i delete one or more of those .dlls, plugin is not recognised by the application. Those .dll are not included in the Qt SDK by default.
Is there any way I can include those .dll in my plugin and add a path to them without copying them to the Qt SDK bin folder.
Usually I add my plugins to my application directory and add this line of code to main() in main.cpp like so:
qApp->addLibraryPath(QString("."));
Image plugins go in imageformats and SQL drivers (ODBC) go in sqldrivers. You can make the library path anything you want relative to your application root directory. I like to keep things simple and just reference the root directory.

Qt resource files in OS X application bundle

I'm trying to build a Qt project which runs fine on windows on OS X 10.6. However, my application cannot access the resources in my qrc file anymore. Are all files in the qrc packed in that application bundle (xyz.app) by default? When I open the generated bundle, there's nothing in the Resources folder except the desktop.rc file. Am I missing something?
Qt translates/converts qrc files into cpp files then compiles and links them into the application binaries. There's no resource file in OS X sense.
The only separate resource file Qt can handle is the application icon. Add this line to pro file:
ICON = MyAppIcon.icns
And it will be copied to the Resources folder and info.plst will be updated to use it.
File names in Windows are not case sensitive, but in OS X they are. Could it be that the file names (or directory names) in your code differ in case from the file names in the resources? If they are, they would still work in Windows but not in OS X.
Well, actually we I switched from a german windows to a us version of osx. All our resources had "de" in their language field, so my us osx couldn't find any resource at all.

How to execute program which have created Qt on windows?

Basically, Qt provide the cross-plateform.
I have made a application which is used Qt creator on Linux.
But, I can't be running that on Windows because it can't find .dll files such as mingw10.dll and qtcore4.dll, etc.
So, I have copied the .dll files which can be found in qt/bin directory.
And, I create a directory in order to save that like /lib becuase of distribution of application.
But, I can't set up path in .pro file.
How to set up the path for .dll?
Thank you.
You can too compile QT statically in order to not have to link dlls to your exe.
You say you've successfully compiled the app, so the only problem is that it can't find the DLLs.
There are a few solutions, and they have nothing to do with the .pro file. Your two best bets are:
Make sure the DLLs are in the same directory as the .exe file
Make sure the DLLs are in a directory contained in the PATH environment variable

Resources