Saturday 6 October 2012

Google vs. Nokia

Well, not exactly.

I'm writing a program that embeds a Google map in a Qt graphical user interface (GUI). Google maps is provided by Google (duh!) and Qt is a GUI framework from Nokia. And the two are not playing nicely.

The problem is that you can't use the mouse to drag the map, or double click to zoom it. A bit of web searching revealed that this is a known issue (http://qt-project.org/forums/viewthread/1643/). The suggested solution is to set the "user agent" string to "Chrome/1.0". I did this and everything started working correctly.

A few days later, the map was back to the undraggable version, so I tried another solution - specifying that one wants version 3.1 of the Google maps API by adding "&v=3.1" to the URL used to load the map. Having done this, everything was working correctly again.

Until a few days later. Now it seems Google no longer serves version 3.1 and any request for it returns version 3.2.

The root cause of the problem is that Google interrogates the Qt web browser component and discovers it has a "multitouch" interface, as used on smart phones and tablet computers. Google then serves a version of Google maps suitable for such devices, but almost  unusable on a normal mouse driven desktop PC. There appears to be no way to disable this feature of Qt without recompiling it, a task that will be beyond most users of the software I'm writing. However, given that it's a compilation option, I do wonder why versions of Qt compiled for desktop PCs have it enabled by default. Do leave a comment if you know a solution.

Meanwhile, I'm off to investigate alternative map providers.

1 comment:

Jim said...

Ask in the right place, and an answer is provided: http://qt-project.org/forums/viewthread/19887/