On 6 Jan 2015, at 08:14, Selmeci, Tamás <tselm...@open-st.eu> wrote:
> Hello all! > > I’m a beginner when it comes to Qt and being stuck for a while with this > issue. > > What I want to do is to force Qt-5.3.2 to render all widgets’ graphics > into the buffer I provide. Would be even nicer if I could specify the > pixel format too. > > When I was adding QWebPage to a program I could make QWebPage render the > web page into a buffer by specifying my custom QPainter and passing it > somehow like this: > > > mainFrame()->documentElement().render(&myPainter); > > > But now I need to redirect all pixel operations to my buffer. In other > words, I need offscreen rendering. > > My program is executing a QML script (QQmlApplicationEngine) and > implements a GUI. I have to have the GUI graphics in the buffer, so that > I can put it into anywhere. Qt’s graphics is going to be copied into an > SDL surface. The final picture in the SDL window is composed of multiple > SDL surfaces (have to emulate /dev/fb0 and /dev/fb1 [overlay] by SDL). > At this stage of development neither 2D-acceleration, nor OpenGL must be > used. What I only want is Qt copy the pixel data into my buffer (and > notify me after the buffer was updated). > > I’m aware that there are multiple platform plugins, including > ‘offscreen’ as well. However I have no clue how to tell ‘offscreen’ my > buffer in which it must work. > > I’ve also thought of implementing my own platform plugin, but I don’t > want to begin the implementation until someone says it’s the best > solution. I’m very unfamiliar with Qt, so I don’t know which aspects to > take care of when implementing a new platform plugin. ‘minimal’ seemed > as something useful, but there are articles on the net that ‘minimal’ is > not supported for production. Perhaps it could be changed to my needs > easily – by the way, my app fails to work with ‘minimal’ plugin (xcb > works well). > > Is there any way I can make my QApplication or QQmlApplicationEngine > render graphics into my buffer instead of the screen? Of course without > OpenGL, EGL and other fancy stuff. Just the with the good old slow > software rendering/blitting. QtQuick 2 items have no built-in support for rendering via QPainter, so it normally doesn’t work without OpenGL. One way to get back an image after the rendering is done is QQuickItem::grabToImage(). There is a commercial add-on to use the raster engine for rendering though, in case you really don’t have an OpenGL-capable GPU: http://doc.qt.io/QtQuick2DRenderer/index.html QtQuick 1 items are rendered with QPainter. QtQuick 1 is likely to be dropped eventually though. _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest