StackView attached properties not visible in pushed objects



  • I have a StackView which includes

    initialItem: Qt.resolvedUrl("file.qml")

    In the root Item in file.qml, I can do

    Stack.view.push(Qt.resolvedUrl("another.qml")).

    But in the root Item of another.qml, a reference to Stack.view gives the error:

    ReferenceError: Stack is not defined

    Shouldn't the StackView's attached properties be visible in any QML file loaded by the StackView?



  • Hmm, have you tried to use parent instead of Stack like:
    @
    parent.view.push(Qt.resolvedUrl(“another.qml”))
    @



  • [quote author="dasRicardo" date="1412850595"]parent.view.push[/quote]

    You can't do parent.view.push, but you can do parent.push. But that's not very convenient if you're not in the root Item.

    I've found that the id: of the StackView is visible in its children, so if its id: is stackView, you can do stackView.push() anywhere in the child.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.