Qt 5.6 how to use QWebEngineView in my custom widget plugin?

时间:2017-10-12 10:06:37

标签: c++ qt qtplugin qwebengineview

I'm trying to create a Qt custom widget plugin to wrap a QWebEngineView. But I found QWebEngineView seems does not work with Qt Designer.

The demo code is attached as below. After build and place this plugin in Qt plugins folder, then Qt Designer will not launch correctly (No GUI window).

If I remove the line m_web = new QWebEngineView();, then the plugin can be loaded by Qt Designer correctly.

How to solve this issue?

enter image description here

#define WEBVIEWWRAPPER_H

#include <QWidget>
#include <QWebEngineView>

class WebViewWrapper : public QWidget
{
    Q_OBJECT

public:
    WebViewWrapper(QWidget *parent = 0);

private:
    QWebEngineView* m_web;
};

#endif


// webviewwrapper.cpp
#include "webviewwrapper.h"

WebViewWrapper::WebViewWrapper(QWidget *parent) :
    QWidget(parent)
{
    m_web = new QWebEngineView(); // if I remove this line, the plugin will be loaded correctly
}

0 个答案:

没有答案