加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

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

发布时间:2020-12-14 01:45:37 所属栏目:Windows 来源:网络整理
导读:有没有办法创建一个全新的窗口实例,作为QmlApplication中主QML窗口的子窗口? // ChildWindow.qmlRectangle { id: childWindow width: 100 height: 100 // stuff}// main.qmlRectangle { id: window width: 1000 height: 600 MouseArea { anchors.fill: pare
有没有办法创建一个全新的窗口实例,作为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中实现新窗口.

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读