我是 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/