qwebview

Qt WebKit and Permanent Cookies

纵饮孤独 提交于 2019-12-04 09:06:59
问题 I have a mainwindow, in it, I have a single QWebView. I want to make a certain website (www.kdkdkkd.com for instance) cookies permanent, so each time a user closes and repopens the browser he doesnt need to log in again. Thanks, 回答1: You need to set your own "Cookie Jar". Use QNetworkAccessManager::setCookieJar . Extend QNetworkCookieJar - as it doesn't persist cookies by default when browser is closed: Once the QNetworkCookieJar object is deleted, all cookies it held will be discarded as

Qt WebView - intercept loading of JS/CSS Libraries to load local ones

£可爱£侵袭症+ 提交于 2019-12-04 05:53:50
I've been looking for a while through documentation to find a way to accomplish this and haven't been successful yet. The basic idea is, that I have a piece of html that I load through Qt's webview. The same content can be exported to a single html file. This file uses Libraries such as Bootstrap and jQuery. Currently I load them through CDN which works when online just fine. However, my application also needs to run offline. So I'm looking for a way to intercept loading of the Libraries in Qt and serve a locally saved file instead. I've tried installing a https QWebEngineUrlSchemeHandler, but

Communication between C++ and Javascript for WebGL

…衆ロ難τιáo~ 提交于 2019-12-04 04:28:17
问题 My friend and I are trying to communicate between C++ and Javascript. We want to render some spheres at a given position with WebGL embedded in a C++/Qt (version 5.6) application. To do that, we use a QWebView which reads a HTML file with all the JS code for WebGL. This works well, we have a great high-level 3D renderer inside our application. The problem is that the position is known by the C++ and has to be shared to the JavaScript . More precisely, the C++ knows the number of spheres we

Crossplatform webview in Qt5.6

拟墨画扇 提交于 2019-12-04 03:59:36
I am using Qt 5.6 with MinGW on Windows 10 64x for developing a cross platform app (desktop + mobile). In Qt 5.5, I could use WebKit to make a cross platform app for showing web pages in my app, and I could use it on Windows, Android, iOs... Today, I realized we can't use it anymore, we can't use QtWebView neither for Windows and also can't use QtWebEngine with MinGW. Thus, I am confused : knowing that I want to show a webpage using my current configuration (for android desktop and mobile version), what should I do? Is there a hope it will be solved in the next Qt versions? Edit: Even when I

Is it possible to call a C++ function from JavaScript in a QWebView?

痴心易碎 提交于 2019-12-03 16:29:27
问题 I have a web page loaded in a QWebView. In there, I would like to have JavaScript call a function of my application. That function would then returns some strings that JavaScript would dynamically display. Can it be done using QWebView? Basically, is it possible to have some bridge between the application (in C++) and the QWebView control? 回答1: This is how I ended up doing it. I declared a "JavaScriptBridge" class in my header file with a Q_INVOKABLE method. Q_INVOKABLE methods can be called

How do I display local HTML in QWebview?

落爺英雄遲暮 提交于 2019-12-03 12:08:16
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 following to get the QWebview object named "reportView" to display my local file? ui->reportView->load(QUrl

How to display html using QWebView. Python?

♀尐吖头ヾ 提交于 2019-12-03 09:27:11
问题 How to display webpage in HTML format in console. import sys from PyQt4.QtGui import QApplication from PyQt4.QtCore import QUrl from PyQt4.QtWebKit import QWebView app = QApplication(sys.argv) view = QWebView() view.load(QUrl('http://example.com') # What's next? how to do something like: # print view.read() ??? # to display something similar to that: # <html><head></head><body></body></html> 回答1: As QT is an async library, you probably won't have any result if you immediately try to look at

Setting useragent in QWebView

眉间皱痕 提交于 2019-12-03 08:41:48
I have a QWebView, which works fine. Then, using code from spynner, I attempt to bind the useragent method to a custom method. This appears to work in spynner (with a QWebPage), but not here. Any help much appreciated. Code: def customuseragent(url): print 'called for %s' % url return 'custom ua' #inside a class self.webkit = QtWebKit.QWebView() self.webkit.page().userAgentForUrl = customuseragent self.webkit.load(QtCore.QUrl('http://www.whatsmyuseragent.com/')) I hope this helps... Your Code def customuseragent(url): print 'called for %s' % url return 'custom ua' #inside a class self.webkit =

Is it possible to call a C++ function from JavaScript in a QWebView?

别等时光非礼了梦想. 提交于 2019-12-03 05:38:44
I have a web page loaded in a QWebView. In there, I would like to have JavaScript call a function of my application. That function would then returns some strings that JavaScript would dynamically display. Can it be done using QWebView? Basically, is it possible to have some bridge between the application (in C++) and the QWebView control? This is how I ended up doing it. I declared a "JavaScriptBridge" class in my header file with a Q_INVOKABLE method. Q_INVOKABLE methods can be called from JavaScript: class DictionaryJavaScriptBridge : public QObject { Q_OBJECT public:

Communication between C++ and Javascript for WebGL

时光总嘲笑我的痴心妄想 提交于 2019-12-01 21:06:44
My friend and I are trying to communicate between C++ and Javascript. We want to render some spheres at a given position with WebGL embedded in a C++/Qt (version 5.6) application. To do that, we use a QWebView which reads a HTML file with all the JS code for WebGL. This works well, we have a great high-level 3D renderer inside our application. The problem is that the position is known by the C++ and has to be shared to the JavaScript . More precisely, the C++ knows the number of spheres we need to display and their position, and has to tell it to the Javascript side. What is the best way to do