qwebview

PDF with QWebView: missing refresh/repaint after loading

匆匆过客 提交于 2020-01-11 07:17:19
问题 I use the QWebView (python 3.3 + pyside 1.1.2 + Qt 4.8) as FileViewer. Picture, Text, HTML, ... all fine, but PDF has a display problem. I tested two possible ways. internal pdf viewer: after use webview.load(file) it loads, but the screen is blank, after loading another file, all works fine, it shows the file pdf.js: after use setContent() with filebase, it loads the webviewer.html/.js with a white page and the loading circle. The screen only refresh if I resize the form or use the

QWebKit doesn't handle click and dblclick for Google Maps

耗尽温柔 提交于 2020-01-06 14:53:23
问题 I just copy/pasted this code from google maps API in a my index.html <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map_canvas { height: 100% } </style> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=MYKEY&sensor=false"> </script> <script type="text/javascript"> function initialize() { var mapOptions = { center: new

QtWebView — C++ — How to get javascript string returned from linkClicked event

随声附和 提交于 2020-01-06 07:25:35
问题 I have been unable to find a definitive answer to my problem. I currently have a QWebView control load an html file that is on my hard-drive, that implements a vector map with javascript actions. The html file loads a jvectormap US States Map. The click action on any state fires the onRegionClick action that is tied to the showCities function, which the event and code arguments are handled by the onRegionClick method implemented in the jquery-jvectormap.js file. The html file follows: <

QNetworkReply: Network access is disabled in QWebView

喜夏-厌秋 提交于 2020-01-04 07:11:22
问题 I cannot load website into my QWebView, QNetworkReply is returning me the error: Network Access is disabled . Loading files from local works. I am using Qt5. Does anyone know why is connection disabled and how this line affects this situation: QNetworkProxyFactory::setUseSystemConfiguration(false); My eth0 connection works properly, and I am able to ping any website. 回答1: From the Qt doc : calling setUseSystemConfiguration() overrides any application proxy or proxy factory that was previously

How to disable sound on flashplayer in my custom application?

给你一囗甜甜゛ 提交于 2020-01-01 14:24:36
问题 I use Qt QWebView component which uses flash-player for video playback. How to disable sound on flashplayer executed inside of my QWebView? One approach that I consider is to execute some javascript code for disabling sound on player, but when to execute it? For example next code disable sound if run it on 1 second after call "load": page.mainFrame().evaluateJavaScript(""" var mute_all_tags=function(tag){ var elems = document.getElementsByTagName(tag); for(var i = 0; i < elems.length; i++){

Read local file from QWebView using Ajax request

孤者浪人 提交于 2019-12-23 17:51:35
问题 I am developing a Qt/C++ program which encapsulates an HTML5/JQuery web app. I used to make Ajax requests to read files from a server. But now, I would like Qt to read a file from the local disk and send its content to my web app. I think I need Qt to catch Ajax requests from the web app and return the file content as the Ajax request result. The problem is I don't know how to do. For now, I've not found anything about that on google. Any help is welcome! 回答1: I finally found how to do it. I

QWebView doesn't load any external resources if it loads a html-file from qresources

Deadly 提交于 2019-12-23 09:41:01
问题 As described in the title my problem is that qwebview doesn't load a html file correctly if it resides in my resources. It loads it perfectly if I load it from outside of the resources as normal local file. But this is not an option for me. I would like to bundle the file with the application. EDIT: By the way, I'm talkin' about external resources from the web. (e.g. http://host.org/somejavascript.js) Thanks for any help 回答1: Please take a look at the second parameter of void QWebView:

QWebEngineView - Javascript Callback

蓝咒 提交于 2019-12-23 03:44:26
问题 What I am ultimately trying to accomplish is to capture the username and password that the user enters into a website. For example, if the user enters "test@example.com" as the email address into Facebook's login, then clicks submit, I want to store that email address in my PyQt Application. The closest I've come to achieving this has been using a series of JavaScript commands to place a listener on the "Login Button" that returns the current value of the user parameter. My problem is that

Applying custom stylesheet to QWebView

懵懂的女人 提交于 2019-12-22 10:44:37
问题 My Qt application loads an external html page within a QWebView widget. How can I define my own stylesheet to present the content of the page? Is it possible to bundle a .css file for QWebView to pick up? 回答1: You can load it with the settings of your QWebView : QWebView myView; QWebSettings * settings = myView->settings(); QUrl myCssFileURL; settings->setUserStyleSheetUrl(myCssFileURL); 来源: https://stackoverflow.com/questions/11297181/applying-custom-stylesheet-to-qwebview

Qt 4.6 Adding objects and sub-objects to QWebView window object (C++ & Javascript)

倾然丶 夕夏残阳落幕 提交于 2019-12-22 05:25:09
问题 I am working with Qt's QWebView, and have been finding lots of great uses for adding to the webkit window object. One thing I would like to do is nested objects... for instance: in Javascript I can... var api = new Object; api.os = new Object; api.os.foo = function(){} api.window = new Object(); api.window.bar = function(){} obviously in most cases this would be done through a more OO js-framework. This results in a tidy structure of: >>>api ---------------------------------------------------