Harmattan Qt Components: "import com.nokia.meego 1.0" or "import com.meego 1.0" ?
-
The topic might seem weird, but let me explain. I noticed that if I create a new Harmattan projects with Qt Creator (that has the experimental Harmattan target), the default QML pages that were created by the Harmattan target have this
@import QtQuick 1.1
import com.meego 1.0@But looking at the QmlComponentsGallery, that comes with the N950 and the source code is available online (at "https://qt.gitorious.org/qt-components/qt-components/trees/master/examples/meego/QmlComponentGallery/qml":https://qt.gitorious.org/qt-components/qt-components/trees/master/examples/meego/QmlComponentGallery/qml), you'll notice that they import Qt Components like this
@import QtQuick 1.1
import com.nokia.meego 1.0@First question would be, which one is the correct one (I guess the second one...)?
Ok, fine, I change in my Harmattan Qt Components application the import to "import com.nokia.meego 1.0" - but then my app wont run anymore! I use a QList<QObject *> as my ListView model and I get this error
bq. file:///usr/lib/qt4/imports/com/meego/PageStack.js:144: Error: Cannot assign QObject* to PageStack_QMLTYPE_24*
My application runs fine, and looks fine, with "import com.meego 1.0" so I wonder which one is correct? Is the latter one a bug, that I cannot use a QList<QObject *> as a list model (which I should be able to do, based on my earlier QML experience).
Any ideas?
-
[quote author="guoqing" date="1312030741"]it depends on the location of your plugins/qml documents. com.meego is mapped to import/com/meego while com.nokia.meego is mapped to import/com/nokia/meego[/quote]
Yes, this is the QML based detailed answer - this is where QML loads the plugins i.e. Qt Components.
But this doesn't answer my question from a Harmattan Qt Component's user point of view. Both can be right, depending on the deployment, but there is just one deployment of Harmattan on the device.
It seems Nokia is using one alternative in their example code and Qt Creator is giving me another one. More interestingly the solution that Nokia is using works worse for me, although their examples run fine on the device.
Confusing.
-
I am getting the same error message when changing from "import com.meego 1.0" to "import com.nokia.meego 1.0"...the related lines of code are:
@ ToolIcon {
platformIconId: "toolbar-add";
onClicked: pageStack.push(Qt.resolvedUrl("AddPage.qml"));
}@ -
FWIW is ended up using only "import com.meego 1.0" and I forgot about this issue altogether. But it's still confusing.
I can guess this is related to the fact that the device has an older version of Qt Components (1.0) while we are looking at the source of QmlComponentsGallery that uses a newer version of it (1.1). It would be nice to get a comment from someone who knows what's going on, but I think we just have to wait for the final release of Harmattan SDK and an update for the N950 with Qt Components 1.1.
-
Both com.meego and com.nokia.meego work on the device, and AFAIK there is no difference between them functionality-wise. However, you cannot mix the two namespaces in one application: You have to use just one all over the place, otherwise you get runtime errors. (The problem seems to be that both directories contain a copy of the same C++ library, while only one library can be loaded at runtime.)
In the end we settled on com.nokia.meego, and I fixed the wizard for Qt Creator 2.3 accordingly. I'm sorry for the confusion, I personally learned about the com.nokia.meego namespace just a few days ago.
-
Yes, I suggest using "com.nokia.meego 1.0" all over the place.
-
But "com.nokia.meego 1.0" still gives the error the op and others experience...would be nice to get this issue solved before recommending folks moving to it...
-
awiese2007, please make sure that you've really no import 'com.meego 1.0' any more in any .qml file used by your application (might also be qml import libraries). If the error is still there, please file a bug report with enough details to reproduce it.
-
"Change to com.nokia.meego made":https://gitorious.org/miniature/miniature/commit/4b04d58042935286ecca146b98fe830fcec61907 and indeed everything seems to work just like before. Thanks!
-
I get the following error if I use com.nokia.meego 1.0 as stated in my original post.
file:///usr/lib/qt4/imports/com/meego/PageStack.js:144: Error: Cannot assign QObject* to PageStack_QMLTYPE_24*
That one import line is the only change I do to trigger this. Any ideas why this would happen?
-
WHen do you get the error? When running your app on the device, or in the Simulator? In case it's the latter, check that 'com.nokia.extras platform' is set to 'Harmattan' in the Simulator settings.