Signal sent to component when shown by StackView?



  • I've got a number of components in a StackView.

    I'd like to trigger animations when the views are shown, meaning when the value of Item::visible in the StackView changes.

    Is there a signal sent to components for those actions? I'd like to handle the action in the item being shown or hidden, not in the StackView.

    Is there a code example of onActivated() being used in this scenario?



  • Hello,

    In QML every property has its on<PropertyName>Changed signal :

    Exemple :

    Rectangle{
    visible : true
    onVisibleChanged : Console.log("visible prop changed to " + visible )

    width : 50
    onWidthChanged : Console.log("new width is " + width )
    }

    LA



  • Hello @igor_stravinsky,

    In QML every property has its on<PropertyName>Changed signal :

    Exemple :

    Rectangle{
    visible : true
    onVisibleChanged : Console.log("visible prop changed to " + visible )

    width : 50
    onWidthChanged : Console.log("new width is " + width )
    }

    LA



  • StackView.onActivated is not a signal of StackView itself, but an attached signal provided by StackView, for the items on the stack.

    Component {
        id: page
        Page {
            StackView.onActivated: console.log("activated")
        }
    }
    
    StackView { 
        id: stackView
    }
    
    // ...
    stackView.push(page)

Log in to reply
 

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