【问题标题】:How to mix Qt3D and default QtQuick.Controls?如何混合 Qt3D 和默认的 QtQuick.Controls?
【发布时间】:2017-10-12 22:51:51
【问题描述】:

我有一个带有 3d 内容的Entity(在 Qt Creator 设计器选项卡中不可编辑)和一个 ApplicationWindow(我希望在 Creator 设计选项卡中可编辑)何将 Qt3d Entity 嵌入到 ApplicationWindow保持ApplicationWindow 在设计器中可编辑(例如绿色框)?

【问题讨论】:

  • 使用Scene3D 组件可能吗?我不完全确定你在问什么。

标签: qt qml qt5 qt-quick qt3d


【解决方案1】:

如果您在设计器中遇到任何组件(不仅仅是 Qt3D)的问题,您应该考虑将您的内容拆分为多个文件。

为您的 UI 添加一个单独的 MyUi.qml 文件并在设计器中进行处理,然后在 main.qml 文件的 ApplicationWindow 中将此文件与您的 3D 场景并排使用。例如:

ApplicationWindow {
    MyUi {
        anchors {
            left: parent.left
            top: parent.top
            bottom: parent.bottom
        }
        width: parent.width / 2
    }
    Scene3D {
        anchors {
            right: parent.right
            top: parent.top
            bottom: parent.bottom
        }
        width: parent.width / 2
        MyRootEntity {
        }
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多