Using regular widgets in QGLWidget in Qt Embedded
-
Hi! I'm working on an environment where I have Qt for Linux Embedded 4.7.2 running on an ARM device, and a screen driver I wrote to enable OpenGL in QWS. I tried to create a simple application which creates a QGraphicsScene and places inside only pixmaps. In this case the, setting the viewport to OpenGL renders the content in OpenGL correctly in Linux Embedded. If I placed a QPushButton inside this using a proxy widget, should I expect Qt to render it using OpenGL paint engine? I tried this, but my application fell back to non OpenGL paint engine. Anyway, the guide seemed to suggest this should be possible (http://doc.qt.nokia.com/main-snapshot/qt-embeddedlinux-opengl.html):
bq. Once a QGraphicsView has been initialized as above, regular widgets can be added to the canvas using QGraphicsProxyWidget if the application requires them.
Should I expect OpenGL to be used for regular widgets as well when placed in the QGraphicsScene? What are the possible reasons why it is falling back to common not accelerated paint engine?
Thanks!
-
No, widgets embedded in a QGraphicsScene via QGraphicsProxyWidget will NOT render with OpenGL. The reason for this is that QGraphicsProxyWidget forces widget's to paint to an offscreen QPixmap and this will use the raster paint engine. The resulting pixmap is rendered to the screen using OpenGL, but the widget itself is rendered with raster.
My advice: Do not use QGraphicsProxyWidget ever. It is slow. Use QML for your widgets. It takes 5 minutes to make a button in QML and it will be fully hardware accelerated.
-
Thanks for your answer. I imagined that was the behavior. Anyway, for me that may be completely acceptable for the moment. My problem is that after I place even only one QPushButton to the QGraphicsScene, the entire scene seems to be rendered without OpenGL. Does this mean anything to you. Is this the correct behavior?
I don't know anything about QML. Is it possible to place QML widgets in a QGLWidget which is drawing OpenGL graphics? And why Qt widgets are rendered accelerated only in QML?
To render a widget in the QGraphicsScene without everything being rendered using the raster engine I had to call the render method directly using the OpenGL paint engine. This works bad in Qt 4.7.2 but seems better in Qt 4.8.0.
Thanks for the information!