[Interest] How do i declare a QGeoCoordinate property in QML?

Jason H jhihn at gmx.com
Mon Sep 26 14:53:10 CEST 2016


I'm not sure I get all the nuances of what you are attempting. The 2nd one has a circular reference. The first once works because you provide separate storage via 'var' so it is not circular.
Resolve the alias down, don't go for indirection.

Item {
property alias coordinateSource: coordinate // don't know you want this to be aliased, you already have a ref to a coordiante.
property alias latitude: coordinate.latitude
property alias longitude: coordinate.longitude
property alias altitude: coordinate.altitude
}

Coordinate { id: coordinate}

> Sent: Monday, September 26, 2016 at 6:49 AM
> From: "Kishore Jonnalagadda" <kitts.mailinglists at gmail.com>
> To: interest at qt-project.org
> Subject: Re: [Interest] How do i declare a QGeoCoordinate property in QML?
>
> I have also tried
> /******/
> Item {
>     id: myMapItem
> 
>     property var coordinate
>     property alias latitude: coordinate.latitude
>     property alias longitude: coordinate.longitude
>     property alias altitude: coordinate.altitude
> }
> /******/
> 
> In the above case which works (I think), I do not understand how to declare 
> the aliases.
> --
> Cheers!
> Kishore
> 
> On Monday 26 September 2016 4:11:03 PM IST Kishore Jonnalagadda wrote:
> > I have created an custom Item in which I want to have a coordinate property.
> > Further i want to create aliases to the coordinates properties. How do i go
> > about this?
> > 
> > Example:
> > 
> > /******/
> > Item {
> > 	id: myCustomItem
> > 
> > 	property coordinate coordinate
> > 	property alias latitude: coordinate.latitude
> > 	property alias longitude: coordinate.longitude
> > 	property alias altitude: coordinate.altitude
> > }
> > /******/
> > 
> > I have also tried the following format...
> > 
> > /******/
> > Item {
> >     id: myCustomItem
> > 
> >     property alias coordinate: coordinate
> >     property alias latitude: coordinate.latitude
> >     property alias longitude: coordinate.longitude
> >     property alias altitude: coordinate.altitude
> > 
> >     Coordinate {id: coordinate}
> > }
> > /******/
> > 
> > But for some reason, the second form results in a segmentation fault.
> 
> 
> -- 
> Cheers!
> Kishore
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 



More information about the Interest mailing list