PDA

View Full Version : Best way to display segregated map of a country



codeslicer
15th February 2010, 15:21
Hi, I'm working on a project, where I need to have a scaleable map widget. Ultimately, I want to have a map of the United States, where individual preset regions or states can be highlighted. For example, I want my program to be able to highlight New England in the US with a red color.

For the moment, I'm considering using several QLabels next to each other with their pixmap properties set, and then use painter composition to change the hue of the image (http://labs.trolltech.com/blogs/2008/11/10/colorize-an-image-via-painter-composition/). Problems with this are:

When application is resized the map does not retain its aspect ratio. I've read that there are some properties like widthForHeight (or something like that) that can be implemented in QLabel's resizeEvent()
The borders of various regions would be rectangular. This could be solved by having transparent overlapping QLabels, but it might cause problems, especially when resizing the application.
It doesn't seem too adjustable or professional.


I've looked around, but if anyone has any suggestions or perhaps there is some Model widget that's already made, please post here. Thanks in advance. :)

~codeslicer

Lykurg
15th February 2010, 15:33
I would use a graphics view. Each item is a state. So you can simply use hover etc. to colour your states. Then put all items in a group and manage there "globally" the size and ratio of the whole shape. Seems to me the simplest solution.

codeslicer
16th February 2010, 00:06
Thanks, I'll try that once I get Qt for WinCE to compile...