How to use qwebkitplatformplugin?

邮差的信 提交于 2020-01-16 03:20:26

问题


how to use qwebkitplatformplugin in a QWebView?

I have the following code:

#include <QWebKitPlatformPlugin>

MainWindow::MainWindow(QWidget *parent, bool new) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    webView = new QWebView;
    ui->webViewLay->addWidget(webView);
    webView->setHtml("<p>test</p>");
}

but found no example of how to use extensions from qwebkitplatformplugin.

[edit]

Within this API has several extensions such as SpellChecker and Notifications, I would like to know how to use in my WebView.

How to use this class? :

class QWebKitPlatformPlugin {
public:
    virtual ~QWebKitPlatformPlugin() {}

    enum Extension {
        MultipleSelections,
        Notifications,
        Haptics,
        TouchInteraction,
        FullScreenVideoPlayer,
        SpellChecker
    };

    virtual bool supportsExtension(Extension) const = 0;
    virtual QObject* createExtension(Extension) const = 0;
};

note: There is no documentation on the official website.


回答1:


Interesting question. Honest answer, I've never attempted it. I've looked at the source though, it seems like you need to subclass the relevant parts you want, and then add the functionality to enable it. However, a Google finds this: https://github.com/QupZilla/qtwebkit-plugins/ which has what you need to implement spell checking, or at least an example if you need to change anything up.



来源:https://stackoverflow.com/questions/17631200/how-to-use-qwebkitplatformplugin

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