qtwebengine

How to get the contentSize of a web page in Qt5.4-QtWebEngine

房东的猫 提交于 2020-01-02 12:48:04
问题 I'm using the new Qt5.4 with the module QtWebEngine and from what I see mainFrame() doesn't exists anymore. How to get the contentSize/size of the page and how to render it now? I tried with the setView and view but doesn't work. 回答1: Check if the QWebEnginePage::geometryChangeRequested signal does what you want. Also you display a QWebEnginePage by creating a QWebEngineView (it's a QWidget ) and calling QWebEngineView::setPage(yourPage) . 回答2: I couldn't find any native Qt method for that,

Cannot load pepper flash plugin in QtWebEngine with Qt5.6

邮差的信 提交于 2020-01-02 07:25:24
问题 I made a simple web browser but when I access to https://get.adobe.com/jp/flashplayer/ It says Adobe Flash Player is already installed, but disabled However as I read http://doc.qt.io/qt-5/qtwebengine-platform-notes.html It says that pepper flash plugin should be automatically loaded if there is a proper dll file. I checked my C:\Windows\System32\Macromed\Flash\ and I'm sure that I have a pepflashplayer32_21_0_0_213.dll there. Then I also set QWebEngineSettings *websetting =

QT 5.4 WebEngine dev tools for javascript

ε祈祈猫儿з 提交于 2020-01-02 06:37:42
问题 I'm creating an application using QWebEngineView and QWebEnginePage. I was wondering if there is a way to active the Web Dev Tools? I need to debug the html, javascript code like you do it using Google Developer Tool on Chrome. If it is not possible in QT 5.4 does anyone know when it is planned to be included in future versions of QT ? 回答1: add these line to your code #ifdef QT_DEBUG qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "9000"); #endif after launching your application start google chrome

Using QWebEngine to render an image

旧时模样 提交于 2020-01-01 09:15:22
问题 I'm looking to replace QWebKit with QWebEngine in my headless renderer. I initialise the page with load() and connect a slot to loadFinished() to generate the final .PNG image. This used to work fine with WebKit but fails with QWebEngine . Code is as follows... _webView = new QWebEngineView(); .... // Render the HTML to an image QPainter painter(&image); _webView->page()->view()->render(&painter); painter.end(); I receive the following errors : "Asking for share context for widget that does

QtWebEngine - synchronously execute JavaScript to read function result

扶醉桌前 提交于 2020-01-01 08:38:13
问题 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? 回答1: The callback is asynchronous because the JavaScript execution occurs not only in another thread but in

Protobuf version conflicts with Qt

倖福魔咒の 提交于 2020-01-01 04:23:11
问题 I'm trying to use protobufs v 3.3.2 with Qt 5.9.1. This works with some Qt applications, but only if they are command line programs. Once I create a GUI application with Qt and protobufs, I get this error: [libprotobuf FATAL /home/mkraus/Documents/dev/star385/build/linux-desktop-debug-libs/protobuf/src/src/google/protobuf/stubs/common.cc:78] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.3.2).

QT QWebEngine render after scrolling?

回眸只為那壹抹淺笑 提交于 2019-12-31 01:27:08
问题 Saving an image of a webpage with a WebEngineView works fine, but when I want to scroll and save another image, the resulting image does not show the website has been scrolled (it shows the top of the webpage). My question is: how do I scroll down in the QWebEngineView then save a screen shot that shows the correctly scrolled webpage? I take a screenshot at the top of the webpage, scroll down ~700 pixels, wait for a javascript callback to trigger which then takes another screenshot. The

Qt: Cannot invoke shared object methods/properties from javascript

只谈情不闲聊 提交于 2019-12-30 11:53:05
问题 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

Qt: Cannot invoke shared object methods/properties from javascript

强颜欢笑 提交于 2019-12-30 11:52:09
问题 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

Static build of QtWebEngine dependent application

耗尽温柔 提交于 2019-12-29 08:51:38
问题 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.