[Qt-qml] How to interface between main.cpp classes and custom c++ based widgets?
Gregory Schlomoff
gregory.schlomoff at gmail.com
Mon Jul 11 21:44:43 CEST 2011
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.
--
Gregory Schlomoff
http://www.gregschlom.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110711/f40e9b6d/attachment.html
More information about the Qt-qml
mailing list