Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
Embed YouTube Video in QWebView: Difference between revisions
AutoSpider (talk | contribs) (Add "cleanup" tag) |
AutoSpider (talk | contribs) (Convert ExpressionEngine links) |
||
Line 8: | Line 8: | ||
= Embed YouTube Video in QWebView = | = Embed YouTube Video in QWebView = | ||
Small snippet showing how to embed a YouTube video in a | Small snippet showing how to embed a YouTube video in a [http://doc.qt.io/qt-5.0/qtwebkit/qwebview.html QWebView]. This also demonstrates Qt support for flash. | ||
First create a Qt Gui Application using Qt Creator and add a QWebView to it. | First create a Qt Gui Application using Qt Creator and add a QWebView to it. | ||
Line 33: | Line 33: | ||
You could also embed this video only in an object tag in a local html file and just point the url to this local file. | You could also embed this video only in an object tag in a local html file and just point the url to this local file. | ||
Detailed article on using flash with Qt can be found | Detailed article on using flash with Qt can be found [http://blog.forwardbias.in/2009/12/flash-in-qgraphicsview.html here] |
Revision as of 08:22, 4 March 2015
This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine. Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean. |
English | Deutsch | Español | Български | 日本語 | Português |
Embed YouTube Video in QWebView
Small snippet showing how to embed a YouTube video in a QWebView. This also demonstrates Qt support for flash. First create a Qt Gui Application using Qt Creator and add a QWebView to it.
Now add network and webkit support to your .pro file
QT += core gui network webkit
Now add this in your mainwindow.cpp file
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QNetworkProxyFactory::setUseSystemConfiguration (true);
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
QWebSettings::globalSettings()->setAttribute(QWebSettings::AutoLoadImages, true);
ui->webView->load(QUrl("http://www.youtube.com/watch?v=3aR27FLbb04"));
}
You should be able to load the webpage with the embedded video in it. You could also embed this video only in an object tag in a local html file and just point the url to this local file.
Detailed article on using flash with Qt can be found here