PDA

View Full Version : Printing from QtQuick.Controls



AlphaX2
12th May 2015, 13:44
Hello,

I came up with the idea to work with QtQuick Controls, because I know QML very well from Nokia and Jolla app dvelopment and like to work with latest standards.

But now I've seen there is no print dialog and also no way to render() QtQuick elements. So my question is: how to reorganise some data and print it? I had just the idea to add all the QWidgets stuff, transfer the data in one/some Widgets and print them in a classic way.

Anyone with a better solution?

AlphaX2

anda_skoa
12th May 2015, 16:10
Yes, there is no print dialog yet for QtQuick.Controls.

For now you have to call a method or slot on an exposed C++ object and let it handle the widget based dialog.

Not sure why you would want to render controls onto a printer though, you wouldn't do that with widget's either.

Cheers,
_

qwert
18th April 2016, 21:47
Well I would like to print some hires QtQuick output to a printer, because QtQuick can do some nice rendering in an easy way. QtWebkit has gone away (Qt-5.6) and QWebengine is all asynchronous, so you never know, when the rendering is finished (only the DOM loading, which happens some undefined time before the rendering finishes).

Rendering QtQuick at a custom resolution into something invisible, which can render itself into a QPainter or can give me a QImage would be great!

anda_skoa
18th April 2016, 22:08
You could try using a QQuickWidget to load the scene and using its render() method to draw into a painter.
Or QQuickWindow::grabWindow() to get an image of the window's content.
Or QQuickWindow::setRenderTarget() to render into a frame buffer object and converting that to an image.

Cheers,
_