My webview function with the following code in my main.cpp
:
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWebEngineView view;
view.setUrl(QUrl(QStringLiteral("http://qt-project.org/")));
view.show();
return app.exec();
}
However, I want to have a MainWindow view and embed my web view in a specific widget inside my mainwindow.cpp
. Here is the code that doesn't work and I'm a bit mixed up with the parent attribut and the object to put in my mainwindow.ui
(design tool).
QWebEngineView *view = new QWebEngineView(parent);
ui->webView->load(QUrl("http://qt-project.org/"));
view->show();
Here is the code for a similar widget that displayed correctly in my project :
QMovie *load = new QMovie(":/animations/scanner.gif");
ui->movieView->setMovie(load);
load->start();