Qt World Summit: Register Today!

Redirecting Qt pixel data to designated buffer

  • 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:


    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.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should rather post this question on the interest mailing list and/or try the qt IRC channel. You'll find there Qt's developers/maintainers (this forum is more user oriented)

  • Thanks, I've subscribed to qt-interest.

Log in to reply