[Marble-devel] User interaction with data in a LayerInterface subclass

Torsten Rahn tackat at t-online.de
Wed May 9 06:06:24 UTC 2012

On Dienstag, 8. Mai 2012 21:08:18 Amit Chaudhuri wrote:
> I want to be able to interact with individual lines or nodes by hovering
> with a mouse, double clicking or selection through a menu.  I want to show
> data such as a node code or a description when an item is hovered over.

Ideally the solution would be to use GeoGraphicsLineString  from 
marble/src/lib/geodata/graphicsitem (This should work in a similar manner to 
GraphicsView), but IIRC it lacks mouse interaction so far (we'd be happy about 
patches that would provide this functionality though).

For its implementation (or for your own GeoPainter based one) you need a way 
to interact with the drawn line though: In order to determine whether the 
linestring  is "hovered" by the mouse you could use

 QRegion GeoPainter::regionFromPolyline ( const GeoDataLineString & 
lineString,  qreal strokeWidth = 3 ) const;

which has been there for this actual purpose.


> I'd like to be able to double click and bring up a read only(?) form which
> holds anything I've chosen to store in a database table associated with the
> item.  This might be notes in an html file, an image of a building, string
> or numeric data or a mixture of all of the above.  I'm quite happy with the
> database side of this but I'm not sure where to start with the marble end.
> Eventually, I'll probably want to have read/write capability (hence '?'
> above).
> Can I do what I want with the LayerInterface approach? If so, how do I
> select an item?  [Might I be able to use the event filter and some
> positional information to achieve this?]
> If LayerInterface won't cut it, what sort of strategy would you suggest?
> Grateful for any pointers..
> Regards,
> Amit (a.k.a A799679)

More information about the Marble-devel mailing list