1

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.qmlwhile Clicking( )を表示できず、text: "LOG IN"Image ボタンをクリックしている間も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に直接ボタンを配置しないでください。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 に答える