[PyQt] LightMaps example
Phil Thompson
phil at riverbankcomputing.com
Tue Oct 5 16:34:36 BST 2010
On Tue, 5 Oct 2010 10:42:43 +0200, "Hans-Peter Jansen" <hpj at urpla.net>
wrote:
> Hi Phil, hi PyQtnistas,
>
> here's another nice example for the collection.
>
> LightMaps is intended for demonstrating, how to display OpenStreetMap
maps
> on mobile devices. It uses interesting tricks including caching for the
> networking part, shows, how to deal with tiled images, and has a funny
> magnifier. Is is lacking one feature: a flexible way to specify the map
> location, since the world is slightly bigger then Oslo, Berlin, and
> Jakarta.. (and centering on Invalidenstraße in Berlin is plain wrong
> anyway, no matter where the Qt office is finally located ;-))
>
> I refrained from doing any extensions for the time being, hence
resembling
> a
> 1:1 translation where possible and sensible.
>
> The only appreciable deviation is, that I'm using a python dict for a
> QPoint
> to pixmap mapping. Unfortunately, the in operator doesn't work then,
> hence,
> I reimplemented a QPoint with a __hash__ method in order to not be
forced
> with QPoint <-> tuple(.x(), .y()) conversions all over..
Thanks - it will be in tonight's snapshot.
> Phil: it might be a good idea to consider adding __hash__ to assorted Qt
> classes in order to improve their pythonic appearance, e,g, QPoint,
QRect,
> QColor. What do you think?
__hash__ is implemented for all classes that implement qHash(). I assume
that that covers the sensible ones.
Phil
More information about the PyQt
mailing list