我在BB-10中写了一个onClick
函数,而点击我无法在点击功能上推送另一个qml文件
NavigationPane {
id: navigationPane
Button {
text: "LOG IN"
onClicked: {
var test = screen.createObject();
navigationPane.push(test);
}
attachedObjects: ComponentDefinition {
id: screen
source: "y.qml"
}
}
}
代码y.qml
如下
NavigationPane {
id:navigationPane
Page {
Container {
ImageButton {
defaultImageSource: "asset:///tabs/home_unf.png"
pressedImageSource: "asset:///tabs/home.png"
disabledImageSource: "asset:///group.png"
onClicked: {
var _home = home.createObject()
navigationPane.push(_home);
}
}
}
attachedObjects: [
ComponentDefinition {
id: home
source: "z.qml"
}
]
}
}
点击(y.qml
)时我无法查看text: "LOG IN"
,也可以点击图片按钮查看z.qml
页面,任何人都可以发送一些解决方案(代码,例子),解决这个问题?感谢
答案 0 :(得分:1)
你无法将一个navigationPane
推送到其他地方这里是样本
您的x.qml
NavigationPane {
id: navigationPane
Button {
text: "LOG IN"
onClicked: {
var test = screen.createObject();
navigationPane.push(test);
}
attachedObjects: ComponentDefinition {
id: screen
source: "y.qml"
}
}
}
您的y.qml
Page {
Container {
ImageButton {
defaultImageSource: "asset:///tabs/home_unf.png"
pressedImageSource: "asset:///tabs/home.png"
disabledImageSource: "asset:///group.png"
onClicked: {
var _home = home.createObject()
navigationPane.push(_home);
}
}
}
attachedObjects: [
ComponentDefinition {
id: home
source: "z.qml"
}
]
}
与致电z.qml
答案 1 :(得分:0)
您不应该直接在NaviagationPane上使用Button将main.qml更改为
NavigationPane
{
id: navigationPane
Page
{
Container
{
Button
{
text: "LOG IN"
onClicked:
{
var test = screen.createObject();
navigationPane.push(test);
}
attachedObjects: ComponentDefinition
{
id: screen
source: "y.qml"
}
}
}
}
}