本页内容

QRasterWindow Class

QRasterWindow 是一个用于在QWindow 上调用QPainter 的便捷类。更多内容...

头文件: #include <QRasterWindow>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
继承自: QPaintDeviceWindow

公共函数

QRasterWindow(QWindow *parent = nullptr)

详细说明

QRasterWindow 是一个QWindow ,具有基于光栅的、非 OpenGL 绘图表面。除了QWindow 提供的功能外,QRasterWindow 还添加了一个虚拟函数paintEvent(),并支持在其自身上打开一个QPainter 。 底层绘制引擎将采用光栅引擎,这意味着所有绘制操作都将在CPU上进行。若需执行基于OpenGL的加速绘制,请改用QOpenGLWindow 。

该类在内部是QWindow 和QBackingStore 的轻量级封装,与直接使用这些类的“光栅窗口示例”非常相似。

另请参阅 QPaintDeviceWindow::paintEvent() 和QPaintDeviceWindow::update()。

成员函数文档

[explicit] QRasterWindow::QRasterWindow(QWindow *parent = nullptr)

使用parent 创建一个新的QRasterWindow。

© 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.