Deploy QML application with localstorage plugin - qt

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

Related

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.

Plugin is not recognized in QML Desktop Appication Deployment

I have wrote a Qt Quick Desktop application in c++ qnd Qt Creator(QML) on Windows7. Now I have to deploy it.
I'm using Qt Quick Desktop Components plugin in my application, I've installed it according to these instructions, and I'm using it with:"import Qt.labs.components", as written there.
I tried adding to the .pro file:
QML_IMPORT_PATH = C:\QtSDK\Desktop\Qt\4.7.4\mingw\imports\Qt\labs\components
but I saw it's working well without it, and I removed it.
I've read a guide how to deploy such an application here, and followed it; I have now a deployment folder, with: the .exe file, the needed dll's, and a folder hierarchy like:Qt/labs/components.
in components I put the styleplugin.dll(for desktop components), and a qmldir file, with the content: plugin styleplugin, excactly like in the doc.
but when I'm runnig my application.exe from the deployment folder in another computer, I'm getting a white, empty window, means: It didn't find the .dll file.
Should you explain me please what's wrong?
I know two reasons, when app can not load plugin dll:
Some of dependecies of the plugin dll are missing or can not be found and that is why it can not be loaded. Qt Creator or Visual Studio environment can be different than the system one. For example, your IDE can modify PATH environment variable. Check plugin's dependencies availability with Microsoft Dependency Walker tool in the same environment where you launch your app.
App can not find plugin in standard directories. To check this you should specify plugin import directory explicitly:
QDeclarativeView *rootView = new QDeclarativeView()
rootView->engine()->addImportPath(QLatin1String("path/to/your/imports"));

How to add .fsh/.vsh shader files to Xcode so they are added to Copy Bundle Resources phase automatically?

Whenever I add a new .fsh or .vsh OpenGL ES 2.0 shader file to my project's resources, the file is added to the Compile Sources build phase where it doesn't belong. I then have to manually remove it from that phase, and manually add it to the Copy Bundle Resources build phase.
Is there any way I can tell Xcode to add files with the extension .fsh and .vsh automatically to the Copy Bundle Resources build phase?
Or is it possible to create a Build Rule that has the same effect as adding the shaders to the Copy Bundle Resources build phase?
I would prefer a solution that works for all users of the Xcode project/workspace, rather than a setting or system change each Xcode user would have to play individually.
Following is a workaround I found. If anyone has any other solutions I'd still appreciate the answer.
What you do to get the shaders into the Copy Bundle Resources build phase automatically is simply to put all the shaders in a common folder (or folder tree). I named the folder "Shaders". Then when adding the Shaders folder select Create folder references for any added folders.
As folder references the files are automatically assumed to be Bundle Resources by Xcode. You just need to be careful not to place any unwanted files into that folder respectively clean up the folder before making a release build. Also loading the shaders requires to use the path to the shader files, ie "Shaders/Examples/Blur.fsh".
My workaround is that I go to File > New File > Others > Empty files and name them as shader.vertsh and shader.fragsh.
I guess Xcode automatically adds files with dot 3/4 extensions to compile phase.
And in case you're missing the Syntax Highlighting, change the File type to 'OpenGL Shading Language Source':

git + Flash Builder workflow: how do I set it up so git works smoothly?

I'm using git to track a project I'm developing in Flash Builder, and I'm wondering the best way to go about having it track it, especially regarding Flash Builder generated files, Compiler generated files, and source files that aren't necessarily flex files.
I had it set up to ignore all of the flash builder .project & debugging directories via .gitignore:
.actionScriptProperties
.flexProperties
.metadata
.project
.settings
bin-debug
and also treating any swf/swc files as binaries via .gitattributes
*.swf -crlf -diff -merge
*.swc -crlf -diff -merge
One issue with this setup is checking out this project and using
it in Flash Builder from scratch:
Flash Builder doesn't like it when
you have a project folder without
the .project files. Only way to
import the source into Flash Builder is to:
Create a new Flex Application
Smother the template files it
created (specifially APP_NAME.mxml)
with a git clone.
Where do I put libraries? From a git perspective, I'd like to have them in the lib folder of the repo so when someone clones the repo, everything just works, but from a local file system perspective I'd like to store all my libraries in a single location and use Flash Builder to reference them, as I may update the library or download a later version. Maybe I should put the libraries in their own repo and load them as a git module? This way I don't need to manually remember to update my Y library files in all X projects that are using them, edit: they will simply update when I update each projects' submodules.
And what about external swfs/flex modules? I've was sticking external swf files in the bin-debug folder for now so the SWFLoader class can find them, but because I'm .gitignoring the bin-debug folder, they don't come with the repo when it's cloned.
One final issue is where to keep the files for the server. Do I have them in a separate repo? I'm using php VOs' with AMFPHP so it's good to be able to edit the php files alongside my actionscript files in Flash Builder... but they don't belong in the project src folder.
The current solution I'm using is:
Creating a 'server' folder in the project root
Pointing an apache virtualhost at it
Setting the run/debug settings to http://APP_NAME.localhost
Then using the server folder as a replacement for bin-debug when the files get exported
The problem with this is I've got a big mess of compiler generated files, and non-AS source files in my server folder. It just doesn't seem like an elegant solution.
How do you set up git to work with flash builder smoothly? Could all this be resolved with multiple git repos/Flash Builder projects, or an ANT script or something?
Thanks.
I've found a good solution which avoids all of the horror of having untracked files and keeping a massive .ignore list:
CLEAN your projects before you git commit.
Simple as that.
Whether it be by Flash Builder or by ant, you should have the ability to clean anyway, so if you simply clean before you commit, the problem of generated files is solved. Duh.
In fact you could probably set it up as a git hook or something.
Typically for eclipse projects with any SCM, I initially check in everything including .projects, etc., but maybe except bin-debug in your case. Then just make sure that anybody who checks out the project never checks back in those .xxx files. For instance, when I use perforce, I first check out the .xxx files to a changelist that I never check in. Then check out the rest to a separate changelist.
Another tip is to use user defined library variables when working with build paths, etc.

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