1

onClick在 BB-10 中编写了一个函数,单击时我无法通过单击函数推送另一个 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页面时,任何人都可以发送一些解决方案(代码,示例)来解决这个问题吗?谢谢

4

2 回答 2

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

于 2013-02-11T07:39:51.640 回答
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"
                }
            }
        }
    }
}
于 2013-01-15T20:16:19.677 回答