Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Hey all!
I've been really excited to get onto the new QML with C++ bandwagon. However, when trying to follow the tutorials (built-in "Charts" example) I've been running into this issue.
It will not allow me to use Designer for QML, as well as add my own modules/C++ plugins.
I've wiped Qt, re-installed and even re-built. Still getting the same error.:(
I've looked over the internet to find only one guy who experienced the same problem and mentioned QmlObserver being used instead of QmlViewer, but I cannot find any option to change this?
I have the brand new Qt 4.7 and I've also tried it with the new Qt Creator 2.0.92 (2.1.0 beta 1)
Here's some images of what I'm seeing:
In Code Editing View:
http://gaiax.webs.com/1.jpg
In Designer View:
http://gaiax.webs.com/3.jpg
Has any body experienced this problem, if so how did you solve it?
Or are there any Qt experts that could help me out, would be much appreciated as I'm excited to start using QML with C++.:)
Thanks in advance.
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Is anybody else experiencing this, or not?
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Ok, this gets even more strange.
I can actually code with C++, create my own types for QML and invokable functions, however. Like in the original pictures they are appearing as invalid in Designer and Code editor... So it is valid at run-time but not whilst coding... What is going on?
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Creator doesn't know anything about your packages and modules so it can't highlight or complete it. You need to write some additional code to make your modules recognizable by Creator.
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Hi Wysota,
Thanks for your reply. Surely, if an example is provided by Qt to view, it should have all code written already. I haven't written this, it came with the Qt package.
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Quote:
Originally Posted by
kona_echinofu
Surely, if an example is provided by Qt to view, it should have all code written already.
It's a coding example, not an example of highlighting qml syntax in Qt Creator which is not the only possible way one might be using Qt. If we try to understand it the way you do, Trolls would have to provide appropriate mechanisms for Visual Studio, Eclipse, KDevelop and all other possible code editors in the world.
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Quote:
Originally Posted by
wysota
It's a coding example, not an example of highlighting qml syntax in Qt Creator which is not the only possible way one might be using Qt. If we try to understand it the way you do, Trolls would have to provide appropriate mechanisms for Visual Studio, Eclipse, KDevelop and all other possible code editors in the world.
I never looked at it that way. Its just frustrating not being able to use c++ with qml designer. Is there anywhere with a tutorial (not the one provided by qt as it doesn't function) or will I have to wait till full release to be able to use qml with c++ with ease?
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Quote:
Originally Posted by
kona_echinofu
I never looked at it that way. Its just frustrating not being able to use c++ with qml designer. Is there anywhere with a tutorial (not the one provided by qt as it doesn't function) or will I have to wait till full release to be able to use qml with c++ with ease?
I have no idea what you mean.
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
I mean setting up Qt 4.7 to allow me to use C++ with QML and QML Designer. At this moment in time, I'm unable to do so as when I create C++ classes and expose them to QML and use them, they work and the application will run, but I cannot use QML Designer as it does not recognise these classes as QML objects and gives me the errors you see in the images.
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Quote:
Originally Posted by
kona_echinofu
I mean setting up Qt 4.7 to allow me to use C++ with QML and QML Designer.
QML and C++ are two different languages. You can't use them "together".
Quote:
At this moment in time, I'm unable to do so as when I create C++ classes and expose them to QML and use them, they work and the application will run, but I cannot use QML Designer as it does not recognise these classes as QML objects and gives me the errors you see in the images.
Did you tell Creator about them by providing an appropriate extension plugin?
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Well I don't exactly mean together, but more in the sense of extending QML.
But regarding the PieCharts example, Creator should know about the Charts object through the code "qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");" which is in main.
From reading the examples and documentation, this should register the Charts Module and PieChart object for use within QML. When I run the application, the Chart appears correctly in the QML embedded within the C++ application.
However, Creator and Designer itself doesn't recognise it whilst in code/designer view.
Added after 8 minutes:
http://gaiax.webs.com/4.jpg
A visual to describe what I mean.
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Quote:
Originally Posted by
kona_echinofu
Well I don't exactly mean together, but more in the sense of extending QML.
But regarding the PieCharts example, Creator should know about the Charts object through the code "qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");" which is in main.
Creator doesn't execute C++ code nor does it know what elements, its properties and such the "Charts" module might be exporting so putting any C++ statement won't have any effect on it.
Quote:
From reading the examples and documentation, this should register the Charts Module and PieChart object for use within QML. When I run the application, the Chart appears correctly in the QML embedded within the C++ application.
If you start reading something, read until the end, please.
Chapter 6: Writing an Extension Plugin
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
I did indeed read it through. However, Chapter 6 is different from what I'm working with now. In chapter 6, yes a plugin is created for use with a QML application. However, the chapters before that do not use a plugin. As stated in the Chapter 6 documentation
Quote:
Currently the PieChart and PieSlice types are used by app.qml, which is displayed using a QDeclarativeView in a C++ application. An alternative way to use our QML extension is to create a plugin library to make it available to the QML engine
.
This is what I'm trying to explain, Chapters 1-5 are not QML applications using a C++ plugin, but a C++ application using QDeclarativeView, displaying QML within a C++ application.
Added after 7 minutes:
Oh, it seems there is a problem. I have stumbled across this reply from a Nokia software developer.
So, I guess I will have to wait for a fix.
http://www.mail-archive.com/qt-qml@t.../msg01207.html
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Do you have the appropriate plugin at all? It won't work unless you have it, regardless of what Trolls fix in qmlobserver. Just like writing code for a custom widget is not enough to see the widget in Designer - you need an appropriate plugin for that. For QML there are three additional components and subset of them may be required in different situations - a qmlproject file, a qmldir file and a binary plugin.
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
I'm having a similar frustrating situation. I'm trying to get this example to run as a plugin to a simple QML project:
http://doc.qt.nokia.com/4.7/declarat...es-adding.html
I'm using QTCreator 2.0.1 on Mac OS X. I feel as if I am very close. The plugin builds fine. I am thinking that all I need to do is to point the QML project file at the plugin. The plugin project is named "custom" so I've been trying things like this in the QML project file:
/* File generated by QtCreator */
import QmlProject 1.0
Project {
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
importPaths: [ "/Users/brucecichowlas/custom-build-desktop" ]
}
It seems as if this is there for my needs. Am I close? What do I need to do?
Thanks,
Bruce
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Do you have the respective qmldir file?
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Hi All,
I have found the same problem as originally reported. I guess the test example is taken from the Qt 4.7.0 Reference Documentation on extending QML. The original test example does not have a .qmlproj file, so the problem is hidden.
Note that "app.qml" runs fine and great either within Qt Creator or with "qmlviewer". This is not an issue.
The real (minor?) issue is that, in Qt Creator's QML editor, both "Charts 1.0" and "PieChart" ARE underlined with a red wave line, which may give us the wrong impression that Qt does not recognize them, although they are actually accepted at runtime.
This is in contrast with the standard module "Qt 4.7" and standard QML element "Item": They are NOT underlined with a red wave line in Qt Creator's QML editor.
Is this a bug in Qt Creator 2.0.1? Should we report it to Nokia?
These are some further details about my setting:
1. In have created "qmldir" file with a single line like this:
plugin Charts ../plugins
2. I have added the following line in "app.qmlproject":
importPaths: ["../plugins"]
All these actions are to try to fix the issue by letting Qt Creator know the name and location of the shared library: ../plugins/libCharts.so. But there is no effect.
Thanks in advance for your reply,
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Quote:
Originally Posted by
jonathanz
Hi All,
I have found the same problem as originally reported. I guess the test example is taken from the Qt 4.7.0 Reference Documentation on extending QML. The original test example does not have a .qmlproj file, so the problem is hidden.
Note that "app.qml" runs fine and great either within Qt Creator or with "qmlviewer". This is not an issue.
The real (minor?) issue is that, in Qt Creator's QML editor, both "Charts 1.0" and "PieChart" ARE underlined with a red wave line, which may give us the wrong impression that Qt does not recognize them, although they are actually accepted at runtime.
This is in contrast with the standard module "Qt 4.7" and standard QML element "Item": They are NOT underlined with a red wave line in Qt Creator's QML editor.
Is this a bug in Qt Creator 2.0.1? Should we report it to Nokia?
These are some further details about my setting:
1. In have created "qmldir" file with a single line like this:
plugin Charts ../plugins
2. I have added the following line in "app.qmlproject":
importPaths: ["../plugins"]
All these actions are to try to fix the issue by letting Qt Creator know the name and location of the shared library: ../plugins/libCharts.so. But there is no effect.
Thanks in advance for your reply,
This is what I've been trying to explain throughout this thread. Its frustrating not being able to use C++ objects with QML Designer!
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
Quote:
Originally Posted by
jonathanz
Is this a bug in Qt Creator 2.0.1?
No, it is not. If it doesn't work then it means your plugin, qmldir or qmlproject file (or all) is incorrect. Actually I can't speak of Creator 2.0.1, I've seen it work in 2.1 but I don't see a reason why this shouldn't work with 2.0.1 as well, the concept of qmldir files was known by the time when 2.0.1 was released.
People, do me a favour - look for errors in your own doings first before you start blaming others. Only when you have exhausted all possibilities that the problem lies on your side, start speaking of bugs in someone else's code or design and even then double check everything first in case you missed something. In my opinion that's a very good rule when it comes to software development.
Re: Qt 4.7 QML/C++ Error : "Package not found" and "Module foobar is not installed"
http://doc.qt.nokia.com/4.7/declarat...es-adding.html
Hm.. I guess there seems to be confusion on what EXACTLY is needed in order to use C++ objects within QML. As the example itself doesn't contain a qmlproject or qmldir file.