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

Dennis Nienhüser earthwings at gentoo.org
Wed May 9 07:42:39 UTC 2012

Am 09.05.2012 08:06, schrieb Torsten Rahn:
> 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;
An example implementation of an interactive layer is in 
src/lib/routing/RoutingLayer. Among other things it implements reaction 
to hovering using the regionFromPolyline method.


More information about the Marble-devel mailing list