首页 > 解决方案 > 如何在 QML 中将父窗口置于子窗口前面

问题描述

目前我有一个根/父 qml 窗口,它创建了一些子窗口。它工作得很好,但是我不能把父窗口放在子窗口的前面。它始终停留在子窗口的背景中。有没有办法改变这个?

父.qml

// parent.qml
Window {
     visible: true
     id: root
     ...
     childComp = Qt.createComponent("child.qml")
     childWindow = childComp.createObject(root)
     childWindow.show() 
    }

以及对应的child.qml

// child.qml
Window {
    id: childWindow
    visible: true
...
}

标签: qtqml

解决方案


推荐阅读