Compiled application don't find QML elements
-
You are doing something wrong, as I use this setup in a project, and I know for a fact that works :-)
-
Andre I am sure that I am doing something wrong. And probably it is a so stupid thing that I can't imagine.
All the work was done on the drive E: and now I am moving the project on the drive C: (standard windows), the same where the SDK is installed.
Its possible that I missed something ?
-
Are you sure you are not using an absolute path somewhere?
-
Yes, Andre, absolutely sure. But at this moment it doesn't matter, because the first step is to see that program running in the compiled version at leat with main working. In previous versions, there was not plugins, so something wasn't working like the jpeg files but it starts and show a blank window of the wrong size. Not only can't be there an absolute path because in the Qt IDE everything works also when I move from one drive to another.
There are two things that I am not sure what means:
- in the project I set these lines on top, because I found this in all the examples and other projects but is possible that I have not understood clearly what does it means.
@# Add more folders to ship with the application, here
folder_01.source = qml
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01@- When I compile, with the settings explained above, Qt create the folder Rc_Hobby_Stream_build_desktop that contains the following subfolders:
qml/qml/main.qml
qml/qml/elements/qml files
release/the compiled exe
debug/the compiled exeThe strange thing is that I don'set in the project (and in the main.cpp program) this double qml/qml folder tree, there is only one folder.
When I run the program from the Qt IDE, I receive the error main.qml not found, because the program search it in the right directory: Rc_Hobby_Stream_build_desktop/qml/main.qmlWell, I remove the redundant /qml/ folder and all works fine. Thisi last thing is what that suggest to me that something is wrong.
-
Finally I found the problem!!!
Last night after another set of annoying tests and controls, I focused where is exactly the problem. Unfortunately this doesn't mean that it is solved, but now I can investigate on the error (??? if it is) seeing in the right direction.
Note: to develop I am using the Qt SDK 1.1 beta, but as I explain further it doesn't matter.
The fact that QML components are working in the IDE while don't work running the program stand-alone suggested to start a line of investigation on main.cpp calling main.qml, and Andre got a lot of helpful hints to check the correct path, see if the QML components were in the right place, if all the dll and plugins were copied etc. Then I have also investigated on the main.cpp code structure.
During my tests I experienced the same problem on linux Ubuntu 10.4LT, Mac OSX 10.5 Snow Leopard, Windows 7 Perfection SP1, Windows XP professional SP2...
At this point a thing was clear: the cpp components of the application was correct. So where is the problem?
-
I created a fresh virtual Windows 7 machine and installed the Qt Creator and Qt SDK 1.0, to have the same development environment as described by Andre some posts above in this thread. The result was the same, so I excluded that in my development configuration with the new SDK 1.1 beta something was wrong.
-
I left unchanged the C sources and structure and changing only the QML sources, using an old version, the 1.0.3 beta of the same application. Astonished last night at 3 A.M. I saw that all was working!!!
At the actual date I am debugging the QML sources, but the thing very strange for me concerns the real question, at this point:
What can be that QML code works only when the program run inside the Qt-Quick IDE, while it shows a blank screen when is run stand-alone (in a separate folder, with the dll and plugins?)
If someone has any idea is welcome :)
-
-
Are you sure you also distribute all the needed libraries that you reference (indirectly) from your QML, and that may be in the path when you run from Qt Creator? I am thinking about things like the QtMobility related libraries...
-
Hi Andre, you think good :)
Plugins was correctly delivered, and all the libraries evidentiated by dependecy walker, but it was not sufficient because there was a couple of dll that needed to be added.
When I checked (this will be in next post) and verified that also the qml was working, I tried to do the oppposite as adding the dll. Added all and removed what I was reasonably sure that are sensless.
And now it works.Remain only the qml debugger that I setup correctly, but when the debugger starts, tell me that the debugger can't connect with the server. This can depend by some piece of code I should add in the source? I only setup all that the guide ask for, but the code remain unchanged.
-
Situation change and update
Atthe actual date, this strange problem has not yet finished to astonish...
The installation directory is working with all the needed dll. While the aplication is in the same computer where is also installed Qt SDK. Then, I tried to move in a "empty" windows machine and the application show the same simpthoms explained before.
So I do the following test: all the dll under .../desktop/mingw/bin was copied in the application directory, while all the plugin dll was copied in subdirectories under the /plugin application directory.
In this condition, the application directory contains all needed and not needed components (it is about 65 Mb). When I copy the application directory in a windows machine where the Qt sdk is not installed, the application starts with a blank screen.
No more ideas to test :)
-
Old thread but thought I'd post my solution: had a bit of the same problem. I was able to sort out all needed dependencies by:
- Using resources for qml files
- Using dependencywalker to find missing dlls in the main exe file, copying them into the exe folder
- Starting from a dummy main.qml that paints a red rectangle. One by one I added the qml imports in main.qml, compiled and then ran the standalone app. If it did not run there was a problem with the imported plugin -> fix it: add the plugin in a QtQuick folder in the directory of the exe + use dependencywalker to check if all the required dlls are present
Its a bit tedious but with this step-wise approach you're sure to sort it out.
edit: never mind, ended up following the instructions "here":http://qt-project.org/wiki/Deploy_an_Application_on_Windows
-
@Alicemirror
Though too late reply yet worth posting.
If qrc is not used then Absolute path of qml file
like
"/home/manoj/QT/qmlFileDemo/main.qml" can solve the problem.