[Development] Qt5.3 / Location Maps

Kate Alhola kate.alhola at gmail.com
Thu Aug 14 13:40:36 CEST 2014


I have done more work towards our app QtQuick2 transition. Several things I
found out
- Qt3d and location with geoservices compiles nicely for Android and iOS
- For iOS by default they still create dynamic libs and needs to be patched
to make static version
- After iOS make is made, make clean distclean does not clean all but if I
would like to compile
   an other platform, I need to take clean snapshot
- For Android, getting geoservices map plugin found during runtime requires
a lot of tweaking, it does not work out of the box even it builds without
problems
- For Ubuntu and OSX all works out of the box

Then back to the previous question, how input data from C++ app to Map.


On Thu, May 8, 2014 at 1:40 PM, Kate Alhola <kate.alhola at gmail.com> wrote:

> On Wed, May 7, 2014 at 3:41 AM, Aaron McCarthy <mccarthy.aaron at 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
>

Least i did not find right way to do this so that 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
>
>>
>>
I Tried also QJSValue but no success by using standard QJSVallue. I was
able to construct array of strut QJSValue but I never succeeded to return
it. I searched all documentation and QTSOurce code unsucessfully.  When I
look Qt Code they always used different way, so may be there is no way to
return QJSValue array using public class ?


       return new QJSValuePrivate(v4, QV4::ValueRef(pathArray));


Finally only way how I did it working was to do same way it was done in

QJSValue QDeclarativePolygonMapItem::path() const


There was just one very ugly thing, it depends a bunch of private headers.


So, only working way to export map path from C++ core to Qml Map is
one that has a lot of dependency to private headers.


I hope still for future:

- Please have function to accept QList<QGeoCoordinate> path. There is
no value added to convert it to QJSValue and then inside of iten back
to QList<QGeoCoordinate> >

-May bey there should be ways to construct QJSValues without using a
lot of private headers.




Kate



> 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 at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/development
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140814/c915c811/attachment.html>


More information about the Development mailing list