I'm working on a QML application for an embedded platform which includes a GridView widget containing images. It's important for me that scrolling through the GridView will be smooth and will not put load on the CPU. Can I expect Qt to use OpenGL to render the GridView?
Asked
Active
Viewed 8,223 times
7
-
As far as I know about Qt QML you can use shaders (there are examples on the Qt site) ... I guess some OpenGl rendering is involved. – Thomas Vincent Jun 27 '11 at 13:46
-
Shaders will come with QtQuick 2.0 (Qt 5.0) or you have to use QtQuick3D. – blakharaz Jun 27 '11 at 18:36
3 Answers
5
I faced with the same problem.
QApplication::setGraphicsSystem(QLatin1String("opengl"));
haven`t work for me. So i set the OGWidget as a viewport:
QDeclarativeView mainwindow;
mainwindow.setSource(QUrl::fromLocalFile("./qml/app.qml"));
QGLFormat format = QGLFormat(QGL::DirectRendering); // you can play with other rendering formats like DoubleBuffer or SimpleBuffer
format.setSampleBuffers(false);
QGLWidget *glWidget = new QGLWidget(format);
glWidget->setAutoFillBackground(false);
mainwindow.setViewport(glWidget);
and do not forget to add opengl in *.pro file.
avida
- 156
- 1
- 6
3
Depending on your platform use
QApplication::setGraphicsSystem(QLatin1String("opengl"));
or (Symbian)
QApplication::setGraphicsSystem(QLatin1String("openvg"));
before you instantiate the QApplication object.
blakharaz
- 2,550
- 11
- 17
2
By default Qt does not use the OpenGL render backend. You can enforce it by using a QGlWidget. In your case, as you want to use a stock widget, you can set the render backend as a command line option:
<binary name> -graphicssystem opengl
ypnos
- 45,954
- 14
- 88
- 130
-
["-graphicssystem" option was deleted from Qt5](https://bugreports.qt.io/browse/QTBUG-41265) – Color Oct 11 '17 at 00:11