QtCreator 4.1.0 不显示用于 MainWindow 表单编辑器的 webengineview(QT 5.7) [英] QtCreator 4.1.0 dosn't show webengineview(QT 5.7) for MainWindow form editor

查看:93
本文介绍了QtCreator 4.1.0 不显示用于 MainWindow 表单编辑器的 webengineview(QT 5.7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的应用从 QT 5.5 移植到 QT 5.7.所以我需要将 WebKit 更改为 QWebeEngine,但是我在 Visual 编辑器的 Widget 浏览器中找不到 QWebEngineView.我如何获得 QWebEngineView 到小部件列表.

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.

我已将 QT += webenginewidgets 添加到 PRO 文件中,但它没有显示小部件.

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

推荐答案

您是否出于任何特定原因需要 Widget 面板中的 QWebEngineView?您可以直接从代码中使用任何 Web 引擎小部件(尽管它当然不像拖放那样简单).举个简单的例子:

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:

这篇关于QtCreator 4.1.0 不显示用于 MainWindow 表单编辑器的 webengineview(QT 5.7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆