user257980
user257980

Reputation: 1089

QtCreator 4.1.0 dosn't show webengineview(QT 5.7) for MainWindow form editor

I'm porting my app from QT 5.5 to QT 5.7. So I need to change WebKit to QWebeEngine, but I can't find QWebEngineView from Widget browser in Visual editor. How I get the QWebEngineView to Widget list.

I have added QT += webenginewidgets to PRO file but it dosen't show the widgets.

Upvotes: 1

Views: 1612

Answers (1)

martinarroyo
martinarroyo

Reputation: 9701

Do you need the QWebEngineView in the Widget palette for any specific reason? You can use any of the web engine widgets directly from code (although it is of course not as simple as a drag-and-drop). As a simple example:

#include <QWebEngineView>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QString url = "https://stackoverflow.com/";
    QWebEngineView view = new QWebEngineView(this);
    view->load(url);
    // Sets the webview to be the main window's central widget.
    setCentralWidget(view);
}

Not sure if this helps you in any way. If you are really interested in having the widget in the designer, you can maybe try adding it as a custom module. Have a look at the following links:

Upvotes: 2

Related Questions