Qt is one of the most popular cross-platform application frameworks. It's easy to integrate CartoType into a Qt application. Qt-compatible CartoType libraries are shipped with the Windows and Linux SDKs.

Platforms

CartoType for Qt is available for Windows, Linux and Mac OS. For Windows and Linux, Qt-compatible libraries are shipped with the SDKs; for Mac OS, libraries are available on request.

Windows

To evaluate CartoType using Qt on Windows (64-bit), download the Windows SDK from the SDKs page,and link your Qt app to these libraries:

  • 64-bit release build: CartoType\bin\15.0\x64\ReleaseDLL\cartotype.lib and CartoType\bin\15.0\x64\ReleaseDLL\CartoTypeQtMapRenderer.lib
  • 64-bit debug build: CartoType\bin\15.0\x64\DebugDLL\cartotype.lib and CartoType\bin\15.0\x64\DebugDLL\CartoTypeQtMapRenderer.lib

The suffix DLL indicates that the libraries link to the DLL version of the C++ runtime library, not the static version.

Linux

To evaluate CartoType using Qt on Linux (64-bit AMD-64), download the Linux SDK from the SDKs page,and link your Qt app to these libraries:

  • 64-bit release build: cartotype-linux-sdk/bin/libcartotype.a and cartotype-linux-sdk/bin/libCartoTypeQtMapRenderer.a

You may need to install OpenGL libraries to enable graphics acceleration. Mesa is one of the most popular implementations.

The API

You use the C++ API to work with CartoType in Qt.

Sample code

The CartoType Maps App is built using Qt Creator, Qt's standard IDE, and runs on Windows, Linux and Mac. The full source code for the Maps App is available on Github.

Choosing a rendering system

Hardware acceleration is smoothest and fastest way to render maps, so that's what you should choose if possible, but you can also use software rendering if you like. The Maps App allows the user to turn hardware accelerated rendering on and off. For guidance on how to do this please see the Maps App source code; a good place to start reading the code is the function MapForm::SetGraphicsAcceleration in src/apps/Maps/mapform.cpp.

If you use software rendering you'll need a function to convert CartoType map bitmaps to QImage objects so that you can draw them in your application window. There's a function called CopyBitmapToImage to do that in the Maps App, in src/apps/Maps/util.cpp.