[Qt-qml] painting
Alan Alpert
alan.alpert at nokia.com
Mon Jun 21 09:37:49 CEST 2010
Mandag 21. juni 2010 17:13:25 skrev Mikola Tapani (Nokia-D/Tampere) :
> What would be the best way of implementing a 'show route' feature to a QML
> maps application? (Route is returned as a lat,lon polyline)
The best way would be to have the application logic backend generate the route
overlay for you. It is needed to calculate the route and provides the map for
you already, so it should be easy for it to provide you with more (like a
rendered polyline pixmap). And it probably wants to interact with the route
some more and thus should have full ownership.
Of course, if you can't change the logic backend then I suppose you could
create a custom C++ polyline item.
> moveTo and then a series of lineTo:s (with a selected brush) would be the
> old 'imperative way'.
If you strictly need imperative drawing, and in cases like this you might, it
should and can be done in an exposed C++ element (or in the application logic
somehow). The old imperative ways aren't forbidden, just not part of the
declarative QML language.
Since doing the application logic in JS is not a key usecase, it is not worth
the confusion it would add if we allowed JS logic to do imperative painting.
--
Alan Alpert
Software Engineer
Nokia, Qt Development Frameworks
More information about the Qt-qml
mailing list