qml 怎么动态生成TabWidget中的tab项
1个回答
展开全部
用TabView可以否?
调用 Qt.createComponent 或者 Qt.createQmlObject 可否?
如 (自Qt,帮助文档)
Item {
id: container
width: 300; height: 300
function loadButton() {
var component = Qt.createComponent("Button.qml");
if (component.status == Component.Ready) {
var button = component.createObject(container);
button.color = "red";
}
}
Component.onCompleted: loadButton()
}
var newObject = Qt.createQmlObject('import QtQuick 2.0; Rectangle {color: "red"; width: 20; height: 20}',
parentItem, "dynamicSnippet1");
调用 Qt.createComponent 或者 Qt.createQmlObject 可否?
如 (自Qt,帮助文档)
Item {
id: container
width: 300; height: 300
function loadButton() {
var component = Qt.createComponent("Button.qml");
if (component.status == Component.Ready) {
var button = component.createObject(container);
button.color = "red";
}
}
Component.onCompleted: loadButton()
}
var newObject = Qt.createQmlObject('import QtQuick 2.0; Rectangle {color: "red"; width: 20; height: 20}',
parentItem, "dynamicSnippet1");
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询