[Marble-devel] Adding a GeoDataPlacemark to a MarbleWidget through GeoDataDocument

Torsten Rahn tackat at t-online.de
Thu May 24 11:59:02 UTC 2012

Hi Cezar,

Yes, it's pretty clear why this happens:

The GeoDataDocument-based approach is completely different from the GeoPainter 

For plain GeoPainter-based rendering you have to "micromanage" what appears on 
the screen for every single frame on the screen. So it's similar to QPainter-
based rendering where you do this stuff in the paintEvent-method. 

The idea of GeoDataDocument is completely different: you feed the model _once_ 
with your data and the rendering for all subsequent frames is done for you.

What your code does is this: You feed the model with a new document for every 
single repaint. So you don't get just 4 placemarks but just as many as 
repaints (that's a lot). The reason that you don't see the dozens of other 
placemarks is that there just 4 valid positions for the labels. 

So instead of overwriting customPaint() and adding your Documents inside that 
Implementation you need to do it in a place that is just called once - that 
would be the main() method in this example.


On Donnerstag, 24. Mai 2012 13:38:48 Cezar Mocan wrote:
> Hello,
> While trying to add a GeoDataPlacemark to a MarbleWidget, I encountered 2
> problems:
> 1) The name of the placemark appears 4 times instead of once
> 2) After adding it, none of the placemarks on the map can be clicked
> anymore, in order to obtain other information about them.
> Any idea why? Should I add some styles to that document?
> Here is the code I've used: http://paste.kde.org/485828/
> Thank you!

More information about the Marble-devel mailing list