QCapturableWindow Class
用于获取可捕获窗口的基本信息。更多...
| 头文件: | #include <QCapturableWindow> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Multimedia) target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
| qmake: | QT += multimedia |
| 自: | Qt 6.6 |
| 在 QML 中: | CapturableWindow |
属性
- description : const QString
- isValid : const bool
公开活动
| QCapturableWindow() | |
(since 6.10) | QCapturableWindow(QWindow *window) |
| QCapturableWindow(const QCapturableWindow &other) | |
| QCapturableWindow(QCapturableWindow &&other) | |
| ~QCapturableWindow() | |
| QString | description() const |
| bool | isValid() const |
| void | swap(QCapturableWindow &other) |
| QCapturableWindow & | operator=(QCapturableWindow &&other) |
| QCapturableWindow & | operator=(const QCapturableWindow &other) |
相关非成员
| bool | operator!=(const QCapturableWindow &lhs, const QCapturableWindow &rhs) |
| bool | operator==(const QCapturableWindow &lhs, const QCapturableWindow &rhs) |
详细说明
该类包含一组窗口信息,但QCapturableWindow::isValid 方法除外,该方法在每次调用时都会获取当前状态。
另请参阅 QWindowCapture 。
属性文档
[read-only] description : const QString
该属性包含对窗口的描述。
在大多数情况下,它表示窗口标题。
访问函数:
| QString | description() const |
[read-only] isValid : const bool
该属性用于标识窗口信息是否有效。
无效的窗口信息是指不存在的窗口,或者不指向任何窗口。
访问函数:
| bool | isValid() const |
成员函数文档
QCapturableWindow::QCapturableWindow()
构建一个不引用任何窗口的空可捕获窗口信息。
[explicit invokable, since 6.10] QCapturableWindow::QCapturableWindow(QWindow *window)
创建一个映射到给定窗口的 QCapturableWindow 实例。
该 QCapturableWindow 的描述将与给定的QWindow 的标题相匹配。
请注意,如果指定的QWindow 尚未显示,则该构造函数可能会创建一个无效的实例。因此,如果Qt应用程序尚未运行,则预计会得到一个无效的QCapturableWindow 实例。可以通过定期查询isValid 来跟踪该实例的有效性。
如果输入为 nullptr,该方法将返回一个永远不会变为有效的实例。
如果传入的窗口不是顶级窗口,该方法将返回一个永远不会变为有效的实例。
注意:此 函数可通过元对象系统以及从 QML 中调用。参见Q_INVOKABLE 。
该函数于 Qt 6.10 中引入。
QCapturableWindow::QCapturableWindow(const QCapturableWindow &other)
使用other QCapturableWindow构建一个新的窗口信息。
[constexpr noexcept default] QCapturableWindow::QCapturableWindow(QCapturableWindow &&other)
通过从other 继承来构建一个QCapturableWindow。
[noexcept] QCapturableWindow::~QCapturableWindow()
清除窗口信息。
[noexcept] void QCapturableWindow::swap(QCapturableWindow &other)
将当前窗口信息与other 互换。
[noexcept] QCapturableWindow &QCapturableWindow::operator=(QCapturableWindow &&other)
将other 移动到此处:QCapturableWindow 。
QCapturableWindow &QCapturableWindow::operator=(const QCapturableWindow &other)
将other 窗口的信息分配给此QCapturableWindow 。
相关非成员
[noexcept] bool operator!=(const QCapturableWindow &lhs, const QCapturableWindow &rhs)
如果窗口信息lhs 和rhs 指向不同的窗口,则返回true ;否则返回false 。
[noexcept] bool operator==(const QCapturableWindow &lhs, const QCapturableWindow &rhs)
如果窗口信息lhs 和rhs 指向同一个窗口,则返回true ;否则返回false 。
© 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.