How to do it...

Let's create a program that displays Google Maps by following these steps:

  1. Create a new Qt Widgets Application project and remove the statusBar, menuBar, and mainToolBar.
  2. Open your project file (.pro) and add the following modules to your project:
QT += core gui webengine webenginewidgets
  1. Open 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 the following:
  1. Open mainwindow.cpp and add the following headers to the top of the source code:
#include <QtWebEngineWidgets/QWebEngineView>#include <QtWebEngineWidgets/QWebEnginePage> ...

Get Qt5 C++ GUI Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.