On Wed, May 7, 2014 at 3:41 AM, Aaron McCarthy <mccarthy.aa...@gmail.com>wrote:
> Hi, > > On Tue, 6 May 2014 15:59:59 Kate Alhola wrote: > > Hi, i have been doing application that uses maps. Application UI is Qml > but > > all data is generated on C++ side and once again, thee basic issue, is > > there any way to add items from C++ to Qml map. > > > > I used Qt4.8 and there was basically same issue, there was no way to add > > any C++ generated stuff on Qml map, no any way to add QGeoMapObject etc > to > > Qml map. I resolved this issue by making own QML wrapper > > around QGraphicsGeoMap that accepts C++ classes. > > > > Then when i switched to Qt5.3, there was no maps at all, I ported Qt4.8 > > maps to Qt5.3 QtQuick1 and that works nicely. I also noticed that it > can't > > be ported to QtQuick2 because old maps depend on QGraphicsView. > > > > Now I checked Qt5.3 location maps with qt3d . All fine, it copmpiles and > > run but alsp all C++ API is gone and there is still no way to add items > > from C++ to map. Even all QGeoMapObjects are gone. > > The Maps C++ API was removed from the public API during the initial > porting to > Qt5. This was done because we didn't want to be tied to a C++ API that we > were > not 100% satisfied with and to focus limited developer resources on the > QtQuick2 implementation. > That's clear and reasonable way of working. Mostly I was missing some way to use data produced from C++ in Qml maps event with standard already defined C++ types like QGeoCoordinate or QList<QGeoCoordinate> Something like in C++ ( qith all QProperty stuff ) QList<QGeoCoordinate> path; And in Qml MapPolyline { line.color: "blue" coordinates:path } Or similar way to have Markers. > > For the time being the best way to place a large number of similar items > on a > map from C++ is to represent those items as a QAbstractListModel and use > it as > the source model for the MapItemView in QML. > It looks that with this Abstract does same thing, I just need to convert old code from QGeoMapObjects/QList<QGeoCoordinate> to QAbstractListModel . Let's see how it works > > QDeclarativePolylineMapItem jas Path property that is type of QJSvalue > and > > that looks only possible hook to c++, create path of polyline in C++ as > > QJSvalua and then pass this to Qml ? > > There is also the addCoordinate()/removeCoordinate() invokable functions > which > are easier to use than constructing a QJSValue, but probably less > efficient if > adding or removing a large number of coordinates. > I hope that this QAbstractListModel does the thing > > What sort of objects are you displaying on the map, is it just polylines? > The application I have is sports app that stores route of training events that are in current version displayed as QGeoMapPolylineObject . The data is generated by our app and stored in database. Application runs on Android/iOS and desktop. Because for usability reasons fast response is important, I wont add extra JS layers just copy coordinates etc fro C++ to Map. We started with Qt4.8 / Necessitas but now we have switched to Qt5.3 /QtQuick1 and next step is to go QtQuick2. > > > What is happening to Qt Maps C++ API ? There is still a lot of us that > > generate data displayed on map in C++ code and use Qml only for UI > > There is currently a lack of developer resources working on the location > module. The good news is that recently the number of contributions to the > location module has increased. > > That's great. If there is anything on our work that can help, i am happy to help. Kate > Cheers, > > -- > Aaron McCarthy > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development >
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development