Pregunta

i have written a onClick function in BB-10 ,while Clicking i can't able to push another qml file the on click function

NavigationPane {
    id: navigationPane
    Button {
        text: "LOG IN"
        onClicked: {
            var test = screen.createObject();
            navigationPane.push(test);
        }

        attachedObjects: ComponentDefinition {
            id: screen
            source: "y.qml"
        }
    }
}

The code y.qml as follows

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"
            }
        ]
    }
}

I can't able to view the y.qml while Clicking(text: "LOG IN") and also while clicking Image button i ned to go z.qml page, can anyone send some solutions(codes,examples),to solve this problem ? Thanks

¿Fue útil?

Solución

you cannot able to push one navigationPane to other here is the sample

your x.qml

NavigationPane {
    id: navigationPane

    Button {
        text: "LOG IN"
        onClicked: {
            var test = screen.createObject();
            navigationPane.push(test);
        }

        attachedObjects: ComponentDefinition {
            id: screen
            source: "y.qml"
        }
    }
}

your 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"
        }
    ]
}

same as call z.qml

Otros consejos

You shouldn't have the Button directly on the NaviagationPane change your main.qml to

NavigationPane
{
    id: navigationPane
    Page
    {
       Container
       {
            Button
            {
                text: "LOG IN"
                onClicked:
                {
                    var test = screen.createObject();
                    navigationPane.push(test);
                }
                attachedObjects: ComponentDefinition
                {
                    id: screen
                    source: "y.qml"
                }
            }
        }
    }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top