QPaintDeviceWindow Class
QWindow 的便利子类,也是QPaintDevice... 更多...
头文件: | #include <QPaintDeviceWindow> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
继承: | QWindow 和QPaintDevice |
继承于 |
公共函数
公共槽
void | update() |
重新实现的受保护函数
virtual void | paintEvent(QPaintEvent *event) override |
详细说明
QPaintDeviceWindow 就像一个普通的QWindow ,同时还具有绘画设备的附加功能。每当需要更新内容时,就会调用虚拟paintEvent() 函数。重新实现该函数的子类只需在窗口上打开QPainter 即可。
注: 该类不能直接用于应用程序。它只是子类(如QOpenGLWindow )的基础。
另请参阅 QOpenGLWindow 。
成员函数文档
[override virtual protected]
void QPaintDeviceWindow::paintEvent(QPaintEvent *event)
重实现:QWindow::paintEvent(QPaintEvent *ev)。
处理event 参数传递的油漆事件。
默认实现不执行任何操作。重新实现此函数以执行绘制。如有必要,可从event 中获取脏区域。
[slot]
void QPaintDeviceWindow::update()
将整个窗口标记为 "脏",并安排重新绘制。
注: 在下一次绘制事件之前对该函数的后续调用将被忽略。
注: 对于未暴露的窗口,更新将推迟到窗口再次暴露时进行。
void QPaintDeviceWindow::update(const QRect &rect)
将rect 标记为脏窗口,并安排重新绘制。
注: 在下一次绘制事件之前对该函数的后续调用将被忽略,但rect 会添加到要更新的区域。
注: 对于未暴露的窗口,更新将推迟到窗口再次暴露时进行。
void QPaintDeviceWindow::update(const QRegion ®ion)
将region 标记为脏窗口,并安排重新绘制。
注: 在下一次绘制事件之前对该函数的后续调用将被忽略,但region 会添加到要更新的区域。
注: 对于未暴露的窗口,更新将推迟到窗口再次暴露时进行。
© 2025 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.