本页内容

OpenGL 加速系列示例

该示例演示了如何为 QLineSeries 和 QScatterSeries 启用 OpenGL 加速。

显示多个 OpenGL 图表堆叠在一起的屏幕截图

运行示例

您可以通过以下方式运行该示例:

启用 OpenGL 加速

要创建一个 OpenGL 加速系列,与普通系列相比,您只需将QAbstractSeries::useOpenGL 属性设置为true :

series->setUseOpenGL(true);

这将使图表实例化一个透明的 QOpenGLWidget,用于在图表上方绘制加速系列。

注意: OpenGL 加速仅支持 QLineSeries 和 QScatterSeries。

示例项目 @ code.qt.io

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.