本页内容

WindowContainer QML Type

允许将任意的 QWindows 嵌入到Qt Quick 场景中。更多内容...

Import Statement: import QtQuick
Since: Qt 6.8
Inherits:

Item

属性

详细说明

该窗口将成为该项目的窗口的子窗口,其位置、大小、Z 顺序等均由该项目管理。

与窗口容器具有更高 z 顺序的同级项目不会自动覆盖嵌入的窗口,因为该窗口位于Qt Quick 场景的最上方。要解决此问题,请将同级项目放置在其专用的子窗口中:

Item {
    id: someItem
    WindowContainer {
        window: foreignWindow
    }
    WindowContainer {
        window: Window {
            Item {
                id: siblingItem
            }
        }
    }
}

同样地,窗口容器的子项也不会自动覆盖嵌入的窗口。要解决此问题,请将子项放置在专用的子窗口中。

Item {
    id: someItem
    WindowContainer {
        id: windowContainer
        window: foreignWindow
        WindowContainer {
            window: Window {
                Item {
                    id: childItem
                }
            }
        }
    }
}

注意: 窗口容器不与QQuickWidget 、QQuickWindow::setRenderTarget()、QQuickRenderControl 或类似功能兼容。

另请参阅 parent()。

属性文档

window : QWindow

该属性保存要嵌入的窗口。

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