[Qt-qml] How to interface between main.cpp classes and custom c++ based widgets?

Till Harbaum / Lists lists at harbaum.org
Mon Jul 11 21:47:43 CEST 2011


Hi,

the uppercase property seems to be working and e.g. 
    Connections {
         target: LocationProvider
         onPositionUpdated: console.log("Position changed")
     }

actually prints "Position changed" ever now and then. However, i'll follow your advise to use lowercase.

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.

Am Montag 11 Juli 2011 schrieb Gregory Schlomoff:
> Next, let's assume your LocationProvider class has a Q_PROPERTY called
> gpsCoordinates. Then, in your qml file, you could do something along the
> lines of:
> 
>  Map {
>   id: map
>   position: locationProvider.gpsCoordinates
>  }
And i assume "position" also has to be a property. Thanks, i'll give that a try.

Regards,
   Till


More information about the Qt-qml mailing list