Jump to content

Enable Plugins in QWebView

From Qt Wiki
Revision as of 17:38, 28 June 2015 by Wieland (talk | contribs) (Cleanup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

So your here to learn how to enable plugins in the QWebView that you've added to your .ui file, so without a further ado, here you go:

#include <QtWebKit>
//make sure the correct headers are included so you can use globalSettings.
#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget* parent) 
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //Create the ui.
    QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
    //And, just enable plug-ins globally.
}

Widget::~Widget()
{
    delete ui;
}