qwebkit

Signal QWebPage::loadFinished(bool) returns twice?

戏子无情 提交于 2019-12-13 19:08:34
问题 I got a problem with QWebPage::loadFinished (bool) signal , it calls back twice , is that normal ? ( there's no link following at all , e.g HTTP status 302 ) Consider the following code , the whole thing may cause problem , is trying to load another link within that slot , will this be a problem ? If i do a qDebug() << thisUrl; each time in loadFinished(bool) slot , i could see it for 3 times , is that normal , one for url XXX , and two for url YYY , and the last two links are exactly the

How to display a QImage in QWebKit?

风格不统一 提交于 2019-12-13 03:30:54
问题 Is there any way to display a QImage (in memory, not on filesystem) in a QWebFrame without writing the image out to a temporary file? 回答1: One option might be using the data URI scheme. You basically base64 encode your picture and write the complete data into the URL. For example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC WebKit should support

Using QWebkit to retrieve divs with a specific class

一笑奈何 提交于 2019-12-13 01:50:17
问题 I posted the question below, trying to use the QDomDocument classes. I was advised to use the QWebkit instead, but I'm very confused how to do what I need to do with QWebkit. I've never used it before so I'm rather unsure with it. Could anyone please offer any advice? Thanks! For the record, the function is using a QByteArray that when translated to text is a standard HTML file. ORIGINAL QUESTION: I have several divs in an HTML file with different classes, like this: <div class='A'>...</div>

QT-Qweb Callback not working in the example here

我们两清 提交于 2019-12-11 17:56:15
问题 Now this code works with the slot mechanism. However, I want to try out the signal way also. However, I am unable to do so? Any more ideas on it? I want to call function f1 of the Javascript from the QT. However, I am unable to do so. I don't see the callback being received by the JS f1(). I have followed the earlier post on it, Qt QWEBview JavaScript callback . However, I am unable to do so. Here is my code. #include <QtGui/QApplication> #include <QApplication> #include <QDebug> #include

How to get the html dom of a webpage and its frames

*爱你&永不变心* 提交于 2019-12-11 10:04:08
问题 I would like to get the DOM of a website after js execution. I would also like to get all the content of the iframes in the website, similarly to what I have in Google Chrome's Inspect Element feature. This is my code: import sys from PyQt4 import QtGui, QtCore, QtWebKit class Sp(): def save(self): print ("call") data = self.webView.page().currentFrame().documentElement().toInnerXml() print(data.encode('utf-8')) print ('finished') def main(self): self.webView = QtWebKit.QWebView() self

How to create Web History for my Browser

笑着哭i 提交于 2019-12-11 07:27:02
问题 I'm new to Qt. I am Trying to create a Sample Browser Application. I had created the Browser application. Now i need to create the Web history for my application. I don't know how to do it. can anyone please help me with this. Thanks in advance. 回答1: QWebHistory * QWebView::history () The Arora Browser is based in the QWebView... as mentioned here. This browser is the foundation for the Arora Browser, a simple cross-platform Web browser. I would look at how they implemented their history. In

PyQt4 does not redirect me to the next page

我们两清 提交于 2019-12-11 03:07:48
问题 The code below works fine except one thing, it does not follow the sign-up link. However if I go to my actual browser and in console type: document.getElementById("link-signup").click() It will redirect me to the desired page. I was thinking that the problem accured because I didn't enable some feature in settings. but I'm not sure. Thank's for any help #! /usr/bin/env python2.7 from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * import sys class GrabberSettings

Qt how to insert html into an editable QWebView at the cursor position?

与世无争的帅哥 提交于 2019-12-10 11:03:07
问题 I'm trying to use QWebView to implement a blog post editor. And I have some sample html snippets to insert into the editor by triggering menu actions. However, it's not convenient as QTextEdit to insert html. As for why I don't use QTextEdit , see my test code following: QTextEdit *edit = new QTextEdit; edit->insertHtml(tr("<div class=\"gci-hello\">Hello</div>")); qDebug() << edit->toHtml(); // --> the div tag disappeared So, if I use QWebView, the div tag will be reserved. But I can't find

how to use QWebPage in a non-GUI application

China☆狼群 提交于 2019-12-09 13:35:25
问题 I want to use QWebPage in a non-GUI Qt application. By that, I mean that I don't want to communicate with the window server at all. Using QtGui is not a problem, though. QWebPage internally creates some QWidget instances. Thus, using QCoreApplication is not possible. When creating a QApplication instance though, I already immediately get a MacOSX dock icon. And I don't want that. It also means that it somehow registers itself in Cocoa as a GUI application. My question is not Mac-only. I would

Webkit_server (called from python's dryscrape) uses more and more memory with each page visited. How do I reduce the memory used?

时间秒杀一切 提交于 2019-12-07 16:44:52
问题 I am writing a scrapper using dryscrape in python3 . I am trying to visit hundreds of different urls during a scrapping session and click through about 10 ajax pages on each url (without visiting a different url per ajax page). I need something like dryscrape because I need to be able to interact with javascript components. The classes I wrote for my needs work, but I am running out of memory when I am have visited about 50 or 100 pages (all 4Gbs of memory are used and 4Gbs of swap disk space