Print QML elements
-
Hello
I am generating a ListModel from a table in my database for my QML UI, and I print it out (physically and PDF) with QTextDocument by placing all values in an HTML table and then calling the print function of the QTextDocument. This works perfectly.
I wanted to print out the bar and pie charts I make in QML, based on the ListModel, but I'm not sure how I'd bring the QML element to a QPainter or anything that allows me to print it out.
Please do advise.
-
Are you using QtQuick 1.x? If so, I'd recommend looking at "QGraphicsView::render()":http://doc.qt.nokia.com/4.7-snapshot/qgraphicsview.html#render as one possible solution. Calling the "paint()":http://doc.qt.nokia.com/4.7-snapshot/qgraphicsitem.html#paint function of the item directly might also be an option.