I found a possible solution using QWebFrame::renderTreeDump()
and QWebFrame::findAllElements()
(new in Qt 4.6).
It doesn't quite "supply additional rendering layers," but accomplishes what I want to do: I call findAllElements()
to scrape the DOM tree, apply any logic I want by setting the HTML element's attributes.
For more complicated operations, such as replacing form controls with my own rendering process, I need to scrape both the DOM tree and the render tree, tinker with the DOM tree so the element doesn't get sent to QPrinter
. In the end, I scrape the resulting PDF file, inject my own rendered for controls using the information I obtained from the render tree and the DOM tree.
This feels unnecessarily complicated. Does anyone has a more elegant solution to this problem?