qt5.5

QWebEngine: print a page?

孤街醉人 提交于 2019-11-27 06:46:06
问题 The migration from QWebKit to QWebEngine seems to be much more complicated than Qt guys claimed. With QWebKit I could print a webpage easily via QWebView->print(&printer); With QWebEngine class QWebEngine view does not provide a method print() . Their browser example uses a class named QWebEngineFrame which offers a method print() - but the whole QWebEngineFrame is not defined anywhere! So my question: how do I print a page using QWebEngine ? 回答1: I think the correct way to use QWebEngineView

QT QWebEnginePage::setWebChannel() transport object

有些话、适合烂在心里 提交于 2019-11-26 16:12:27
问题 I'm using the QT WebEngine framework to display web pages. I'm injecting javascript into a page when it loads, and want to allow the javascript to be able to access a QT object. Apparently, to do this a QWebChannel must exist that establishes some IPC between chromium (the javascript) and the rest of my C++/QT project. I came across the QWebEnginePage::setWebChannel (QWebChannel *channel) function, however I can't find any examples of its use. The documentation (http://doc.qt.io/qt-5