qtwebkit

How to parse HTML with C++/Qt?

天涯浪子 提交于 2019-11-27 02:53:31
问题 How can i parse the following HTML <body> <span style="font-size:11px">12345</span> <a>Hello<a> </body> I would like to retrive the data "12345" from a "span" with style="font-size:11px" from www.testtest.com, but I only want the that very data, and nothing else. How can I accomplish this? 回答1: EDIT: From the Qt 5.6 release blog post: With 5.6, Qt WebKit and Qt Quick 1 will no longer be supported and are dropped from the release. The source code for these modules will still be available. So,

QWebView or QWebEngineView

北城以北 提交于 2019-11-27 00:58:53
问题 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? 回答1: 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

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

China☆狼群 提交于 2019-11-26 18:25:17
问题 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> 回答1: 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

Headless browser with full javascript support for java

半世苍凉 提交于 2019-11-26 18:17:56
问题 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? 回答1: Nathan Ridley's answer to another similar question is the most

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

随声附和 提交于 2019-11-26 15:26:34
问题 How to tell QWebPage not to load specific type of resources like js, css or png? 回答1: 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>

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

 ̄綄美尐妖づ 提交于 2019-11-26 13:08:31
问题 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? 回答1: 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.