qtwebengine

QtWebEngine - synchronously execute JavaScript to read function result

情到浓时终转凉″ 提交于 2019-12-04 02:21:34
I have the following method in one of my C++ classes (using QtWebEngine): QString get() { QString result; view->page()->runJavaScript("test();", [this](const QVariant &v) { result = v.toString(); }); return result; } It is to execute test() JS function and return the result of this invocation. Unfortunately, the callback is asynchronous and the program crashes. How can I make it work? The callback is asynchronous because the JavaScript execution occurs not only in another thread but in another process . So there is no way to make it fully synchronous. The best possible solution would be to

QWebEngineView update with pdf path

核能气质少年 提交于 2019-12-02 03:21:44
I have a QtWebEngineWidgets showing some pdf files. I want to change pdf and force QtWebEngineView display automatically and dynamically. The problem I get is the QtWebEngineWidgets does not update, incapabile to display when pdf file path changes. class PdfReport(QtWebEngineWidgets.QWebEngineView): PDFJS = 'file:///pdfjs/web/viewer.html' def __init__(self, parent=None): super(PdfReport, self).__init__(parent) self.PDF = 'file:///Technicalreport/file0.pdf' self.load(QtCore.QUrl.fromUserInput('%s?file=%s' % (PDFJS, self.PDF))) @QtCore.pyqtSlot(int) def index_load(self, _index): self._index =

Unable to get mp3 support with QtWebEngine

安稳与你 提交于 2019-12-01 22:14:12
问题 I built QtWebEngine 5.7.1 from git sources to get support of proprietary codecs. I wrote "WEBENGINE_CONFIG+=use_proprietary_codecs" to the qtwebengine.pro. While qmake was configuring the project, I saw the log saying that MP3 et H264 codecs were enabled. I spent one day to get QtWebEngine fully compiled with msvc2015 in 32bit and ... The mp3 support still not working ! I use html5test.com to get a quick look of webbrowser capabilities. I searched a bit and I found out about a ffmpegsumo.dll

How To Build Qt WebEngine for PyQt5?

核能气质少年 提交于 2019-12-01 17:02:47
Qt WebEngine This link show python wrapper for Qt WebEngine . Please can canyone tell me how can i add this in pyqt5 environment? Thanks!!! It seems I got it working: Either install pyqt version 5.10, which still ships the web engine, either install a newer (I use 5.12) and install PyQtWebEngine separately. pip3 install PyQtWebEngine Now these imports work: from PyQt5.QtWebEngineWidgets import QWebEnginePage from PyQt5.QtWebEngineWidgets import QWebEngineView I can't tell you the whys, I didn't find any explanation, just a clue here: PyQt 5.11 missing WebEngine modules 来源: https:/

Qt: Cannot invoke shared object methods/properties from javascript

别说谁变了你拦得住时间么 提交于 2019-12-01 11:42:58
I have tried exactly same as the answer of Vicky Chijwani for this question QT QWebEnginePage::setWebChannel() transport object and everything fine but I cant able to invoke any methods or properties of jshelper. kindly look at my code myclass.h class MyClass : public QObject { Q_OBJECT public: MyClass(QObject *parent = 0); void print(); int num; signals: public slots: }; myclass.cpp MyClass::MyClass(QObject *parent) : QObject(parent) { num=100; } void MyClass::print() { QMessageBox bx; bx.exec(); } mywebengineview.h class MyWebEngineView : public QWebEngineView { public: MyWebEngineView

Static build of QtWebEngine dependent application

让人想犯罪 __ 提交于 2019-11-29 14:35:12
I have an application (audio player for http://vk.com ) which uses OAuth 2.0 authorization. What i did was that i implemented QtWebEngineView object and used it to open an authorization page. Basically, it looks like currently i'm using quite a big class for such a little job. Anyway, i need to make a static build of my application — unfortunately, from my researches i've discovered people saying that making a static build of QtWebEngine-dependent application is not possible for some reasons. Is this true? If so, are there any alternatives — maybe some classes made for OAuth 2.0 authentication

How can I get paint events with QtWebEngine?

。_饼干妹妹 提交于 2019-11-29 10:20:48
问题 I extended QWebEngineView . #ifndef MYQWEBENGINEVIEW_H #define MYQWEBENGINEVIEW_H #include <QWebEngineView> class MyQWebEngineView : public QWebEngineView { public: MyQWebEngineView(QWidget *parent = 0); ~MyQWebEngineView(); protected: virtual void paintEvent(QPaintEvent *); }; #endif // MYQWEBENGINEVIEW_H But I can't get paintEvent(QPaintEvent *) called. #include "myqwebengineview.h" #include <QPaintEvent> #include <QPainter> #include <QWebEngineView> #include <QWidget> MyQWebEngineView:

Capture server response with QWebEngineView

北城余情 提交于 2019-11-29 08:43:58
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 QNetworkRequest class and then load requests with these specific requests in QWebView. How do I do this with

How to compile Qt webengine (5.11) on Windows with proprietary codecs

心已入冬 提交于 2019-11-29 02:26:43
I have a lot of trouble compiling Qt webengine to enable proprietary codecs , documentation is not very clear. I followed others instructions on stackoverflow but it doesn't work. I got error like: Project ERROR: Cannot run compiler 'cl'. Output: =================== =================== Maybe you forgot to setup the environment? OR Needs VS 2015 Update 3 with Cumulative Servicing Release or higher Qt WebEngine will not be built. OR Could not detect Windows SDK Version ('WindowsSDKVersion' environment variable is not set). Qt Webengine on Windows requires a Windows SDK version 10.0.10586 or

QtWebEngine debugging

試著忘記壹切 提交于 2019-11-29 01:16:12
Recently Qt introduced the QtWebEngine module. Is there a way to invoke developer tools and debug JavaScript code inside QWebEngineView ? It was possible with QWebView using page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); but I couldn't find any similar option in QWebEngineView . I just ran across this so I added it here for posterity. It was just added to Qt 5.5 git. You have to enable it via an environment variable QTWEBENGINE_REMOTE_DEBUGGING=<port> . You can put 0.0.0.0:<port> if you are doing debugging of an embedded device and cant use the local console.