圖形

Cross-platform applications can use Qt to display graphical elements. Qt abstracts the platforms' underlying graphics APIs so that developers can focus on the application code.

The Qt Rendering Hardware Interface (RHI) translates 3D graphics call from Qt applications to the available graphics APIs on the target platform.

The supported graphics APIs are:

  • OpenGL (version 3 and higher)
  • OpenGL ES (version 2 and higher)
  • Vulkan (1.0 and higher)
  • Direct3D 11 (11.1 and higher)
  • Metal

Graphics in Qt Quick

Qt Quick applications use a 場景圖形 for rendering. The scene graph renderer can create efficient graphics calls and increase performance. The scene graph is has an accessible API which gives you the flexibility to create complex but fast graphics.

The pages in the following list contain more information about rendering Qt Quick applications.

Choosing a Rendering Path

Qt uses the target platform's graphics APIs whenever possible, however, it is possible to set up Qt's rendering path with a specific API. In many cases, choosing a specific API can increase performance and allows the developers to deploy on a platform that have a specific graphics API. Visit the 憑藉 Qt 渲染硬件接口進行渲染 page on how to set the render path in QQuickWindow .

3D Graphics with Qt Quick 3D

Qt Quick 3D is an add-on that provides a high-level API for creating 3D content and 3D user interfaces based on Qt Quick. It extends the Qt Quick 場景圖形 which lets you implement 3D content on 2D Qt Quick applications.

著色器效果

The Qt Shader Tools provides a tool, QSB , to translate vertex and fragment shaders into a package for Qt Quick interfaces. In particular, the ShaderEffect QML 類型和 QSGMaterial subclasses can use the output of QSB. Qt Quick 3D has its own framework for importing shaders into 3D scenes.

The following list contains information about shader effects.

High-Level Graphics with Qt GUI

Qt GUI provides a high level windowing, painting, and typography system. QPainter provides an API for drawing vector graphics, text and images onto different surfaces, or QPaintDevice 實例,譬如 QImage , QOpenGLPaintDevice , QWidget ,和 QPrinter . For Qt Widgets user interfaces, Qt uses a software renderer.

The following list contains information about Qt GUIs high-level drawing APIs.

Qt OpenGL 模塊

The Qt OpenGL module is for applications that require OpenGL access. This module is to maintain compatibility with Qt 5 applications and with Qt GUI. For user interfaces that use QWidget , QOpenGLWidget is a widget that can add OpenGL scenes.

打印

Qt 支持直接打印到本地或網絡的實際打印機,及産生 PDF 輸齣。如何采用 Qt 進行打印的詳細描述在 Qt Print Support 頁麵。

圖像

Qt 支持圖像的方便讀取、寫入及操縱透過 QImage 類。此外,對於如何更細粒度控製圖像的加載或保存,可以使用 QImageReader and QImageWriter 類。為添加由 Qt 所提供的其它圖像格式的支持,可以創建圖像格式插件通過使用 QImageIOHandler and QImageIOPlugin .

讀寫圖像文件 頁麵,瞭解更多信息。