WindowContainer QML Type

允许在Qt Quick 场景中嵌入任意 QWindows。更多

Import Statement: import QtQuick
Since: Qt 6.8
Inherits:

Item

属性

详细说明

窗口将成为项目窗口的子窗口,其位置、大小、z-order 等均由项目管理。

由于窗口位于Qt Quick 场景的顶部,因此 Z 排序高于窗口容器的同级项目不会自动与嵌入窗口重叠。要解决这个问题,可将同级项放入自己专用的子窗口中:

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

该属性包含要嵌入的窗口。


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