qwebview

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

喜夏-厌秋 提交于 2019-12-22 05:25:08
问题 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 ---------------------------------------------------

QWebEngineView modify web content before render

自闭症网瘾萝莉.ら 提交于 2019-12-22 01:29:50
问题 I have three questions about QWebengineView (Qt 5.7.0): How can I modify the web content (add extra html/javascript) during load (before render) How can I get events when javascript resource included in webpage is loading ( I want to modify them, too). I get html content by page()->toHtml then set it back by setHtml , but content rendered don't like original (seems to loss format) Thanks for help! 来源: https://stackoverflow.com/questions/38162751/qwebengineview-modify-web-content-before-render

How do I display local HTML in QWebview?

怎甘沉沦 提交于 2019-12-21 03:55:25
问题 I suspect this is so basic that no one bothered to document it. I want to write an HTML file from my program, and then load that file into a QWebview object. When I have QtCreator open, I can navigate to the file in the URL block on the right and it displays within QtCreator. When I compile and run the program, the window is white and blank. I also don't want the directory hardcoded, I want it to use the current directory. So I guess there are two questions: How do I write the ??? in the

Qt Widgets FullScreen Margin

穿精又带淫゛_ 提交于 2019-12-20 05:47:25
问题 I want to create a program that loads google in literally full screen, so I achieved opening my qt program in full screen using w.showFullScreen(); and it works perfectly, however when I add the QWebView and set it to centralWidget like this: but when I run the program, I get some margins on the sides of the window, in other words the QWebView isn't literally in fullScreen harmoniously with the window which is, it looks like this: I don't think my code is mistaken but here it is untitled.pro:

Capture server response with QWebEngineView

十年热恋 提交于 2019-12-17 19:56:02
问题 I'm trying to create a Dialog in Qt which loads a URL (which I do not want to expose to the end-user, hence a Dialog). Once the user has entered their credentials on the page, the server returns a redirect URL which I want to capture. How can I do this? QtWebkit made this easy to do as QWebView had a QNetworkAccessManager object. But with QtWebEngine, the QWebEngineView class does not have this capability. The former also allowed HTTP headers to be set for any requests by using the

How to get the QLayouts to expand properly?

强颜欢笑 提交于 2019-12-13 05:59:17
问题 My structure is as follows: QWidget -QHBoxLayout -QLabel -QVBoxLayout -QLabel -QWebView I want the HBoxLayout to fill the width however large the container may be but go no more or less. However, I want the QVBoxLayout to expand to accommodate the size of its contents in the vertical direction. +-------------+------------------------------+ | FixedTitle: | Expanding to Width Title + | |------------------------------+ | | + | | this is a test which wraps to+ | | the next line + | | + | | + | |

How to write content to QNetworkReply (was: QWebview with generated content)

会有一股神秘感。 提交于 2019-12-13 03:42:19
问题 I am using a QWebview to display html generated by the same program. Now the html can have references to other resources, e.g. <FRAME src=...> in a fram set. When the browser would start downloading that resource, I must intercept that request and suply the content myself, since there's no webserver involved. Where are the hooks that I may use to catch up the requested url and supply the generated content? to create the browser widget: self.browser = QWebView() self.layout.addWidget(self

what is the Default user-Agent of PyQt Web kit Qwebview and how to get it

人走茶凉 提交于 2019-12-13 02:23:46
问题 i am new to python and developing a GUI in PyQt which has a Web Browser. I want to show the User-Agent going with the Url but not founding a way.my code is - class Manager(QNetworkAccessManager): def __init__(self, table): QNetworkAccessManager.__init__(self) self.finished.connect(self._finished) self.table = table def _finished(self, reply): headers = reply.rawHeaderPairs() headers = {str(k):str(v) for k,v in headers} content_type = headers.get("Content-Type") # some code like "print headers

QWebView allow pop-ups?

北城以北 提交于 2019-12-13 02:18:38
问题 In my project, I have a QWebView that loads a page that opens a pop-up window. But the window won't open. I looked into the createWindow function but I have no clue how to subclass a widget. These are some settings I put onto the webView: QWebSettings *settings = ui->webView_2->settings(); settings->setAttribute(QWebSettings::JavascriptEnabled, true); settings->setAttribute(QWebSettings::JavascriptCanOpenWindows, true); What is the easiest way to allow my webView to allow pop-up windows?

open plotly in qwebview in interactive mode

微笑、不失礼 提交于 2019-12-12 09:57:48
问题 I'm using plotly library in offline mode with python and what I'm trying to do is to create some plot, save them as local html and load in a second moment into a QWebView. This is the code for a boxplot with a dummy variable: from PyQt5.QtWebKitWidgets import QWebView import plotly import plotly.graph_objs as go x1 = [10, 3, 4, 5, 20, 4, 3] trace1 = go.Box( x = x1) layout = go.Layout( showlegend = True ) data = [trace1] fig = go.Figure(data=data, layout = layout) fn = '/home/matteo/plot.html'