问题
Hi I am trying to implement a mapview using blackberry cascades based on this link but whenever I import maps
import bb.cascades.maps 1.0
,
the QNX IDE throws out an error saying
bb.cascades.maps is not installed
.
I have set up the environment exactly as described in the developer site and dont seem to understand how do i install this module.
回答1:
They seem to have left out some steps. Not all cascades objects are loaded by default into the development system, but they can be added at runtime. The biggest drawback is that the Eclipse can't do static analysis of the QML for errors only general syntax.
If you add the following lines to the main.cpp file you may get the example to work (I hacked this into one of my current projects and got it to load without errors but the MapView is all black):
#include #include <bb/cascades/maps/MapView>
Then just before the QmlDocument::create call:
qmlRegisterType<bb::cascades::maps::MapView>("bb.cascades.maps", 1, 0, "MapView");
This is the mechanisim that is used quite frequently to make Cascades objects not included in the default setup available, or to make your own specializations from CustomControl or other Cascades objects available to QML.
Finally this example seems to pre-date beta 3 so there may be some other issues that you may have to work through.
EDIT
I did some poking around and found this thread on the BlackBerry forum. Setting the altitude to 10000 actuall got me a usable map on the simulator and the Dev Alpha. It obviously needs more work but you can interact with it (drag to move, pinch to zoom, etc).
回答2:
The MapView component seems to have been largely unusable until the most recent SDK update (10.0.9.2318), as somewhat admitted and referenced by this Blackberry DevBlog post: http://devblog.blackberry.com/2013/01/cascades-mapview/
Also, check out the new CustomMapView example on Github for a working sample app using this latest update: https://github.com/blackberry/Cascades-Samples/tree/master/custommapview
For the QML preview issue, this is known issue. QML Preview currently only supports the core cascades components. See my more detailed answer here: blackberry 10 Unresolved inclusion <QObject>
来源:https://stackoverflow.com/questions/13359087/blackberry-cascades-mapview