Hi,

using properties for this somehow feels wrong. The locationProvider is sending 
a positioninfo. This isn't a property of the map as the map does not store the 
positioninfo, it just extracts a coordinate from this and uses that to update 
itself.

My solution is now to make the LocationProvider a named child of QApplication. 
Any other C++ code can then get a reference to this from QApplication via 
static methods (so no further context required). I don't know how ugly this is, 
but it doesn't feel to bad :-)

Till

Am Montag 11 Juli 2011 schrieb Gregory Schlomoff:
> Hi,
> 
> Why can't i use the above statement within my Map in qml? This:
> >
> >  Map {
> >    Connections {
> >         target: LocationProvider
> >         onPositionUpdated: console.log("Position changed")
> >     }
> >  }
> >
> > results in "Cannot assign object to list
> >         Connections {
> > "
> >
> > while i can do the same with a real qml object
> 
> 
> What happens is that "real qml objects" are subclasses of QDeclarativeItem,
> and QDeclarativeItem has a default property named "children". So to be able
> to put a Connections object inside your Map object, you must add a
> Q_PROPERTY to your Map class that takes a list of QDeclarativeConnections
> (or more generally, a list of QDeclarativeItem, or even of QOBjects, if you
> wish), and make this property as default.
> 
> 

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to