QtWebkit: console application

大憨熊 提交于 2019-11-30 10:08:40
Marçal Juan

QtWebkit can be used in a widget-less environment, but can't be executed with QCoreApplication.

The solution is to use a fake X server to execute the program.

Install Xvfb and then:

xvfb-run --server-args="-screen 0 1024x768x24" ./framecapture google.cat google.png

PD: Using framecapture Webkit example from docs: http://doc.qt.io/archives/qt-4.7/webkit-framecapture.html

Job

QWebPage can be used in a widget-less environment.

To load a page, do something like this

QWebPage page;
QUrl url = ...;
page.mainFrame()->load(url);

To get access to the DOM tree, you can use QWebFrame::documentElement(). See the API for how to use this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!