【发布时间】:2014-02-13 21:11:34
【问题描述】:
我有一个项目,我想在其中添加一个类,这取决于一个变量
import "class1"
import "class2"
Item { id: myID
property variant myVar: 0;
anchors.fill: parent;
function update() {
switch(myID.myVar)
{
case 0:
class1 {
anchors.fill: parent;
}
break;
case 1:
class2 {
anchors.fill: parent;
}
break;
}
}
}
其实这是一个错误的代码,有什么办法吗?
谢谢。
【问题讨论】:
标签: javascript c++ qt qml