Skip to Content
Hands-On GUI Programming with C++ and Qt5
book

Hands-On GUI Programming with C++ and Qt5

by Lee Zhi Eng
April 2018
Intermediate to advanced
404 pages
8h 27m
English
Packt Publishing
Content preview from Hands-On GUI Programming with C++ and Qt5

Adding the web view widget

Once you are ready, let's get started! First, open up Qt Creator and create a new Qt Widgets Application project. After that, open up the project (.pro) file and add in the following text to enable the modules:

QT += core gui webengine webenginewidgets 

If you didn't install the MSVC component (on Windows) or the Qt WebEngine component, error messages will appear at this point if you are trying to build the project. Please run the Qt installer again if that's the case.

Next, open up mainwindow.h and add the following header files:

#ifndef MAINWINDOW_H 
#define MAINWINDOW_H 
 
#include <QMainWindow> 
#include <QWebEngineView> 

After that, open up mainwindow.h and add the following code:

private: 
   Ui::MainWindow *ui; 
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ GUI Programming with Qt 4

C++ GUI Programming with Qt 4

Jasmin Blanchette, Mark Summerfield

Publisher Resources

ISBN: 9781788397827Supplemental Content