-
Book Overview & Buying
-
Table Of Contents
Qt5 C++ GUI Programming Cookbook
By :
In this example, we will learn how to embed Google Maps in our project through Qt's WebEngine module. This example doesn't focus much on Qt and C++, but rather on the Google Maps API in HTML code.
Let's create a program that displays Google Maps by following these steps:
First, create a new Qt Widgets Application project and remove the status bar, menu bar, and tool bar.
Then, open up your project file (.pro) and add the following modules to your project:
QT += core gui webengine webenginewidgets
Next, open up mainwindow.ui and add a vertical layout to the canvas. Then, select the canvas and click the Lay Out Vertically button on top of the canvas. You will get something like this:

Then, open up mainwindow.cpp and add the following headers to the top of the source code:
#include <QtWebEngineWidgets/QWebEngineView> #include <QtWebEngineWidgets/QWebEnginePage> #include <QtWebEngineWidgets/QWebEngineSettings>
After that, add the...