qml - 我可以使用Qt quick UI 项目来开发一个真正的产品吗?

标签 qml

我是 Qt Quick 开发的新手,我使用的是 Qt 5.2。花几个小时找到最终创建选项卡 View 的方法。 下面是我在 gui.qml 中的代码:

import QtQuick 2.1
import QtQuick.Window 2.1
import QtQuick.Controls 1.1
import QtQuick.XmlListModel 2.0

Window {

    width: 538 + frame.margins * 2
    height: 360 + frame.margins * 2

    ToolBar {
        id: toolbar
        width: parent.width
    }

    SystemPalette {id: syspal}
    color: syspal.window


    Rectangle {
        anchors.top: toolbar.bottom
        anchors.right: parent.right
        anchors.left: parent.left
        anchors.bottom:  parent.bottom
        anchors.margins: 8

        TabView {
            id:frame
            focus:true

            property int margins: Qt.platform.os === "osx" ? 16 : 0

            height: parent.height - 34
            anchors.right: parent.right
            anchors.left: parent.left
            anchors.margins: margins

            Tab {
                title: "Home"
            }
            Tab {
                title: "Edit"
            }
            Tab {
                title: "View"
            }

            Tab {
                title: "Help"
            }
        }
    }
}

我用Qt Creator创建了一个qt quick ui工程,它只有两个文件,一个是gui.qml,一个是gui.qmlproject。我可以将其用作真正的产品项目吗?如果是,如何添加我的 C++ 代码,例如当主窗口弹出时,将默认窗口标题“QtQmlViewer”替换为我的产品名称。

最佳答案

您可能需要另一种类型的项目:QtQuick 2 Application (Built-in elements)This文章可能会有所帮助。此外,QtQuick 控件可能需要另一个启动文件。尝试 this如果您的应用无法加载 QML 文件

关于qml - 我可以使用Qt quick UI 项目来开发一个真正的产品吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20758230/

相关文章:

c++ - 使用 C++ 从 QML 单例中读取属性

scope - QML 范围 : property binding in child object failing

qt - 如何在 QtQuick 2.0 中创建滚动条?

javascript - qml js中没有原型(prototype)

performance - 文本区域记录速度慢

javascript - 如何在 QML Javascript 中创建和使用 C++ 对象

c++ - 如何迭代QAbstractListModel?

c++ - 将 c++ QAbstractSeries 添加到 QML 图 TableView

python - 在 PySide2 中为 QML 注册枚举

qt - 如何重写父类(super class)组件的信号处理程序