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

笑着哭i 提交于 2019-12-24 07:58:44

问题


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.


回答1:


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:

  • http://doc.qt.io/qt-5.7/designer-using-custom-widgets.html
  • http://www.ics.com/blog/integrating-custom-widget-qt-designer


来源:https://stackoverflow.com/questions/40673412/qtcreator-4-1-0-dosnt-show-webengineviewqt-5-7-for-mainwindow-form-editor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!