如何从QML内创建一个新窗口?

前端之家收集整理的这篇文章主要介绍了如何从QML内创建一个新窗口?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
有没有办法创建一个全新的窗口实例,作为QmlApplication中主QML窗口的子窗口?
// ChildWindow.qml
Rectangle {
    id: childWindow
    width: 100
    height: 100
    // stuff
}

// main.qml
Rectangle {
    id: window
    width: 1000
    height: 600

    MouseArea {
        anchors.fill: parent
        onClicked: createAWindow(childWindow);
    }
}

我正在尝试避免编写一个Q_OBJECT类,仅用于在新的QmlApplicationViewer中实现新窗口.

@H_403_8@ 没有办法仅使用内置的QML功能来创建顶级窗口.

然而,有一个名为Desktop Components的Qt Labs项目,其中包含一个Window component,它允许您创建新的顶级窗口.

原文链接:https://www.f2er.com/windows/363671.html

猜你在找的Windows相关文章