问题
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