qtwebkit

How to get Javascript in a QWebView to create new instances of C++ based classes?

谁说我不能喝 提交于 2019-11-29 07:23:11
I've successfully added an C++ object to a QWebFrame with addToJavaScriptWindowObject , and can call a slot on that object from javascript. But what I really want to do is have one of those slots return a new object. For example, I have a slot like this, which returns a QObject derived class instance: MyObject* MyApp::helloWorld() { //MyObject is dervied from QObject return new MyObject(); } I can call this slot from javascript successfully like this var foo=myapp.helloWorld(); But foo appears to be empty, I can't call any slots or access any properties on it from Javascript. Any ideas on how

how to get response in QtWebKit

泪湿孤枕 提交于 2019-11-29 04:32:32
im beginner with QtWebKit i build simple web frame that loaded page ( server side ) and when from this page i submit data i like to catch the response string from the server in the c++ side how can i do that ? I tinkered around with Qt (which I'm new to) and found a way to catch all resources downloaded by WebKit. Here's how: 1) Create your own subclass of QNetworkAccessManager 2) In your derived class, override virtual function createRequest 3) Call base class implementation to get the response object. After that you can look at the URL (or other parameters) and determine whether you need to

QWebView or QWebEngineView

[亡魂溺海] 提交于 2019-11-28 05:53:34
Are there any functional differences between QWebView and QWebEngineView? If I understand correctly, QWebView is webkit, while QWebEngineView is blink. Are there any differences to the programmer? Does one offer more customization of look & feel over the other? I would give QtWebEngine a try. It is replacing QtWebKit for a reason. If you control the HTML that is getting rendered, then it probably doesn't hurt to use QWebKit. Just make sure you test your pages beforehand. QWebView uses WebKit as the backend. http://doc.qt.io/qt-5/qwebview.html#details QWebEngineView uses Chromium as the backend

How to get Javascript in a QWebView to create new instances of C++ based classes?

帅比萌擦擦* 提交于 2019-11-28 04:06:03
问题 I've successfully added an C++ object to a QWebFrame with addToJavaScriptWindowObject, and can call a slot on that object from javascript. But what I really want to do is have one of those slots return a new object. For example, I have a slot like this, which returns a QObject derived class instance: MyObject* MyApp::helloWorld() { //MyObject is dervied from QObject return new MyObject(); } I can call this slot from javascript successfully like this var foo=myapp.helloWorld(); But foo appears

Project ERROR: Unknown module(s) in QT: webkitwidgets

时光总嘲笑我的痴心妄想 提交于 2019-11-27 18:26:42
I am porting code from qt4 to qt5. I added the following line to my .pro file, as suggested : QT += webkitwidgets However, when I run qmake , I get the this error: Project ERROR: Unknown module(s) in QT: webkitwidgets I am developing on Ubuntu 12.04 LTS and installed Qt as described . You need to install the webkitwidgets library. On Ubuntu, try this in a terminal: sudo apt-get install libqt5webkit5-dev If you need to install the webkit* Windows library for Qt 5.7 you should compile it manually because in new version webkit (WebView?) replaced by WebEngine. Read about Qt 5.7 release (comments)

How to render PDF using pdf.js viewer in PyQt?

自古美人都是妖i 提交于 2019-11-27 14:53:44
I have tried adding the pdf.js viewer files in my project and it works in browsers like Chrome, Mozilla, Safari, etc, but it's not loading some pages in node-webkit and PyQt webkit. I am trying to load the file using an iframe, like this: <iframe src="/test/?file=/assets/pdf/example.pdf#page=3"> </iframe> I've found this thread over at the Qt Forums , where thebeast44 posted a snippet of Qt code answering your question. My translation to python is below. You'll also need to unpack the res folder from the author's original code , I think he just modified the viewer... I've also attached said

Can I use homebrew's qt5 with capybara-webkit?

為{幸葍}努か 提交于 2019-11-27 13:43:26
问题 I want to use qt5's QtWebKit with capybara-webkit . brew uninstall qt Uninstalling /usr/local/Cellar/qt/4.8.4... brew install qt5 This formula is keg-only: so it was not symlinked into /usr/local. 🍺 /usr/local/Cellar/qt5/5.0.2: 3103 files, 140M, built in 60.9 minutes If I force brew to create the symlinks for qt5 I can build the native extension for capybara-webkit .. brew link --force qt5 Linking /usr/local/Cellar/qt5/5.0.2... 122 symlinks created gem install capybara-webkit -v '1.0.0'

Headless browser with full javascript support for java

◇◆丶佛笑我妖孽 提交于 2019-11-27 13:31:12
I have been using HtmlUnit (the developers did a great job) as an headless browser for some of my previous applications but the javascript support isn't working for some website that my next application will be accessing. I heard about QtWebKit binding for Python but my application will be in Java or is there a Java binding for WebKit or QtWebKit? Does anyone know a good headless browser for Java with full javascript support? Haroldo_OK Nathan Ridley's answer to another similar question is the most complete one I've found so far. Anyway, if everything fails, you could use a Python or JS

How to tell QWebPage not to load specific type of resources?

五迷三道 提交于 2019-11-27 11:03:38
How to tell QWebPage not to load specific type of resources like js, css or png? The solution is to extend QNetworkAccessManager class and override it's virtual method QNetworkAccessManager::createRequest In our implementation we check the path of the requested url and if it's the one we don't want to download we create and hand over an empty request instead of the real one. Below is a complete, working example. #include <QApplication> #include <QUrl> #include <QtWebKit/QWebPage> #include <QtWebKit/QWebFrame> #include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkRequest>

How to know when a web page is loaded when using QtWebKit?

白昼怎懂夜的黑 提交于 2019-11-27 07:19:49
Both QWebFrame and QWebPage have void loadFinished(bool ok) signal which can be used to detect when a web page is completely loaded. The problem is when a web page has some content loaded asynchronously (ajax). How to know when the page is completely loaded in this case? I haven't actually done this, but I think you may be able to achieve your solution using QNetworkAccessManager . You can get the QNetworkAccessManager from your QWebPage using the networkAccessManager() function. QNetworkAccessManager has a signal finished ( QNetworkReply * reply ) which is fired whenever a file is requested