qtwebkit

QWebView not loading external javascript?

天涯浪子 提交于 2019-12-01 12:02:39
It is possible to load an external javascript file from the html using QWebView? In the following QtProject (all files in the same directory) there is javascript code directly inside the html and also in an external file. I'm missing the external behavior while loading it in QWebView (in the browser it works fine): MyApp.pro QT += core gui webkitwidgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = MyApp TEMPLATE = app DESTDIR = ./ SOURCES += main.cpp HEADERS += main.cpp #include <QApplication> #include <QtWebKitWidgets> #include <QFile> int main(int argc, char *argv[]) {

the sound don't stop when QWebView window closed (loaded with youtube video)

无人久伴 提交于 2019-12-01 10:53:14
问题 I load a youtube video with QWebView by the following code ,when the video is playing I close the QWebView window ,but I still can hear the voice from that video even when QWebView window is closed, so is there any way to stop the sound by code when QWebView window is closed ? from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * import sys app = QApplication(sys.argv) view = QWebView() view.resize(1230,760) view.settings().setAttribute(QWebSettings.PluginsEnabled,

QWebView not loading external javascript?

馋奶兔 提交于 2019-12-01 09:52:09
问题 It is possible to load an external javascript file from the html using QWebView? In the following QtProject (all files in the same directory) there is javascript code directly inside the html and also in an external file. I'm missing the external behavior while loading it in QWebView (in the browser it works fine): MyApp.pro QT += core gui webkitwidgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = MyApp TEMPLATE = app DESTDIR = ./ SOURCES += main.cpp HEADERS += main.cpp #include

Suppressing SSL errors

ぃ、小莉子 提交于 2019-12-01 05:57:19
I want to be able to read the headers sent back from a webpage in SSL mode. My Qt app however can't reach the webpage because it's in SSL mode I am gathering? Normal webview browsing in SSL is possible in my app using this connect: connect(view->page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> & )), this, SLOT(onSslErrors(QNetworkReply*, const QList<QSslError> & ))); This suppresses the SSL errors in the webview but I have a separate function which get's the headers using this method: //Send a request to validate URL QNetworkAccessManager *manager = new

Suppressing SSL errors

淺唱寂寞╮ 提交于 2019-12-01 04:26:39
问题 I want to be able to read the headers sent back from a webpage in SSL mode. My Qt app however can't reach the webpage because it's in SSL mode I am gathering? Normal webview browsing in SSL is possible in my app using this connect: connect(view->page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> & )), this, SLOT(onSslErrors(QNetworkReply*, const QList<QSslError> & ))); This suppresses the SSL errors in the webview but I have a separate function which get's

Is this the right way to set the SSL protocol with QWebPage?

∥☆過路亽.° 提交于 2019-12-01 00:47:44
I've been working with SSL in Qt, where I need to set a specific protocol (instead of the default "secure protocols"). It looks like this works: QSslConfiguration config = QSslConfiguration::defaultConfiguration(); config.setProtocol(QSsl::TlsV1_0); QSslConfiguration::setDefaultConfiguration(config); But it makes me uncomfortable to set the protocol in a global way like this, instead of setting it on the QWebPage or QWebView or something. Am I missing something obvious or is this really the best way to do this? I know I can set it on an SSL socket, but I'm using QtWebKit, and don't have access

Invoke C++ method from webviews Javascript

本小妞迷上赌 提交于 2019-11-30 23:45:13
In qt4 qml the qtwebkit 1.0 the component webview has a property javaScriptWindowObjects . I used it to add javaScriptWindowObjects to the context of my webpages javascript to call c++ functions. like so WebView{ url: "http://test.com" anchors.fill: parent scale: 1.0 javaScriptWindowObjects: QtObject { WebView.windowObjectName: "native" function foo(x, y) { console.log("This is a call from javascript"); myCppHandler.fooNative(b,c); } } } so i can call it from the webpages javascript like so <script type="text/javascript"> native.foo(1,2) </script> but in qt5 qml qtwebkit 3.0 there is no such

Qt/webkit and flash

旧城冷巷雨未停 提交于 2019-11-30 19:43:21
I have installed pyqt 4.8.1 on xp and Qt in package. I have a tag like <object ...> <param value='1.swf'> <embed src='1.swf'></embed> </param> </object> But Qt/webkit doesn't show flash. (there is not problem with code and IE or chrome). Does Qt/webkit support flash? All you have to do is enable plugins. See the python specific Qt example but in C++ its like this. QWebPage *webpage = ... webpage->settings()->setAttribute(QWebSettings::PluginsEnabled, true); Plugins are loaded by NPAPI http://en.wikipedia.org/wiki/NPAPI use AC_RunActiveContent.js. for your flash embed, it works in all browsers.

Is this the right way to set the SSL protocol with QWebPage?

﹥>﹥吖頭↗ 提交于 2019-11-30 18:59:38
问题 I've been working with SSL in Qt, where I need to set a specific protocol (instead of the default "secure protocols"). It looks like this works: QSslConfiguration config = QSslConfiguration::defaultConfiguration(); config.setProtocol(QSsl::TlsV1_0); QSslConfiguration::setDefaultConfiguration(config); But it makes me uncomfortable to set the protocol in a global way like this, instead of setting it on the QWebPage or QWebView or something. Am I missing something obvious or is this really the

How to get detailed error message when QTWebKit fails to load a page?

自古美人都是妖i 提交于 2019-11-30 14:53:13
问题 QtWebKit calls QWebPage::loadFinished ( false ) when a web page failed to load - but gives no clue as to why it failed. How do I get a detailed error message, like HTTP response code or other message? 回答1: It turns out there are a couple ways to get more detail about failures: Implement the onResourceRequested and onResourceReceived callbacks on page: page.onResourceRequested = function (resource) { log('resource requested: ' + resource.url); } page.onResourceReceived = function (resource) {