Displaying position markers on a map

If I tell you my favorite restaurant is located at (40.7802655, -74.108644), you won't be able to make sense of it. However, if those coordinates are being displayed on the map view in the form of a location marker, instantly, you will have an idea of where it is. Let's see how we can add position markers to our map view!

First of all, we need a marker image that should look something like this, or even better, design your own marker:

After that, we need to register this image to our project's resource file. Open up resource.qrc with Qt Creator and create a new prefix called images. Then, add the marker ...

Get Hands-On GUI Programming with C++ and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.