qtwebkit

How to stretch/shrink HTML Page to fit in QWebView window

为君一笑 提交于 2019-12-12 03:48:24
问题 I am using QWebView to render a html page using setHTML method. In the html page body section I am mentioning width and height for the html page, if we are changing the width and hegiht of the QWebView window at run time by calling setGeometry(x,y,w,h), then how to make the html page adjust itself to fit the content fully in streched QWebView window? 回答1: You need to handle window.onresize() event in javascript. Insert following code in your html... <script text = "javascript"> window

How to Clean Up subprocess.Popen Instances Upon Process Termination

不想你离开。 提交于 2019-12-11 14:27:29
问题 I have a JavaScript application running on a Python / PyQt / QtWebKit foundation which creates subprocess.Popen objects to run external processes. Popen objects are kept in a dictionary and referenced by an internal identifier so that the JS app can call Popen 's methods via a pyqtSlot such as poll() to determine whether the process is still running or kill() to kill a rogue process. If a process is not running any more, I would like to remove its Popen object from the dictionary for garbage

QtWebPage - loadFinished() called multiple times

£可爱£侵袭症+ 提交于 2019-12-11 08:16:19
问题 In my application, I have list view. Selecting another item in it, triggers an event: connect(listView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(item_changed(const QModelIndex &, const QModelIndex &))); void MainWindow::item_changed(const QModelIndex & current, const QModelIndex & previous) { qDebug() << "\n" << "item_changed(), caller: " << sender()->objectName(); if (current.isValid()) { /* not so important code */ change_query(tokens

Error using capybara-webkit (really QtWebKit webkit_server) on MacOS X due to libpng version incompatibility

a 夏天 提交于 2019-12-11 05:19:00
问题 I get the following error when trying to execute any capybara test using the capybara-webkit driver: dyld: Library not loaded: /usr/X11/lib/libpng15.15.dylib Referenced from: /usr/local/Cellar/qt/4.8.0/lib/QtGui.framework/Versions/4/QtGui Reason: Incompatible library version: QtGui requires version 20.0.0 or later, but libpng15.15.dylib provides version 17.0.0 /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.9.0/lib/capybara/driver/webkit/browser.rb:200:in initialize': Can't

PySide QWebView and downloading unsupported content

ぃ、小莉子 提交于 2019-12-11 04:25:18
问题 Below is the code for a minimal browser using PySide for demoing webapps and the like. It generally functions as I'd like though I can't quite seem to get my head around how to successfully download unsupportedContent. In the Finished method self.reply.readAll() returns an empty QByteArray. Any help would be greatly appreciated. Thanks import sys import os from PySide import QtCore, QtGui, QtWebKit, QtNetwork class Browser(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__

QT5 Text rendering issue

ぃ、小莉子 提交于 2019-12-11 01:40:00
问题 I have cross compiled QT5 on a MIPS based platform. Whenever I run application including sample apps, (Which contains text), first it draws the text and later paints the area of text with "rectangle" fill of Text Color. So finally I see a black rectangle all the places where text is displayed. If i change the text color, the color of rectangle also changes. Has anybody faced this issue? Any suggestions? Even when I run qtwebkit, I see that URL part, the text in any HTML page is painted with

QWebInspector not working correctly

北城余情 提交于 2019-12-10 20:13:28
问题 I have included the QWebInspector in my QT project and try to use it in my code (not entirly sure how as I am still quite new to QT) I get a blank Web Inspector screen so I think the page() is returning null? Where am I going wrong or is this only for HTML5 applications? #include "mainwindow.h" #include "ui_mainwindow.h" #include <QtGui> #include <QSsl> #include <QSslError> #include <QNetworkReply> #include <QtDebug> #include <QWebInspector> #include <QGraphicsWebView> #include <QMessageBox>

Qt Webkit Bridge: C++ access to JavaScript

帅比萌擦擦* 提交于 2019-12-10 20:08:50
问题 I am using a QWebView and call to setHtml() to display some HTML/JavaScript pages. I am passing data updates using QWebFrame::evaluateJavaScript by passing it a QString containing a call to a JavaScript function (with arguments). After reading about the Qt WebKit Bridge I feel like there should be a better way to do his. I see discussion of exposing Qt objects / functions in C++ to the JavaScript, but not the other direction. (I do not want the JavaScript to poll the C++ side for updates.) Is

Print webpage from QtWebKit.webView to pdf PyQt4

て烟熏妆下的殇ゞ 提交于 2019-12-10 20:03:56
问题 Hi what i'am trying to accomplish is that, i have a QWidget with a custom QtWebKit.QWebView which displays a particular website. I want to save that web page as a pdf using python and PyQt. from PyQt4 import QtCore, QtGui from PyQt4 import QtWebKit from Save_Evidence import * import sys ##### Custom WebView ############# class Browser(QtWebKit.QWebView): def __init__(self,parent =None): QtWebKit.QWebView.__init__(self,parent) self.loadFinished.connect(self._result_available) def _result

Qt: QWebview not displaying jpg, gif, png images on another machines

我怕爱的太早我们不能终老 提交于 2019-12-10 16:18:42
问题 Today I came across a very strange error with QWebView which I cannot resolve myself. I included a QWebView widget in my application. When I set a URL or a piece of HTML code to display (with QWebView::setUrl() or QWebView::setHtml() ), it works very well on my machine. It also works on all machines that have Qt installed, but not on those without it. I compiled a release build and included all necessary libraries as shared ( QtWebKit4.dll , QtNetwork4.dll etc.), so I guess my error lies in