Managing browser history

Qt's web engine stores all the links which the user has visited into an array structure for later use. The web view widget uses this to move back and forth between history by calling back() and forward().

If you need to manually access this browsing history, add the following header to mainwindow.h:

#include <QWebEnginePage> 

After that, use the following code to obtain the browsing history in the form of a QWebEngineHistory object:

QWebEngineHistory* history = QWebEnginePage::history(); 

You can get the entire list of visited links from history->items() or navigate between history using functions such as back() or forward(). To clear the browsing history, call history->clear(). Alternatively, you can also do this:

QWebEngineProfile::defaultProfile()->clearAllVisitedLinks();
To learn more about the QWebEngineHistory class, visit the following link: http://doc.Qt.io/Qt-5/qwebenginehistory.html.