PySide: AnchorChanges in state transmission not working



  • Hello,

    I'm trying to animate an BorderImage element with two states (shown, hidden) using AnchorChanges.
    But everytime the state transmission should be performed PySide prints the following error:
    Unable to assign QObject* to QDeclarativeItem*
    (this seems to belong to the target property, since with commenting it the error disappears but then no animation is shown)

    Sample code as follows:
    @BorderImage {
    id: screenKeyboard

    state: "hidden"

    states: [
        State {
            name: "shown"
            AnchorChanges {
                target: screenKeyboard
                anchors.top: undefined
                anchors.bottom: menuBar.top
            }
        },
        State {
            name: "hidden"
            AnchorChanges {
                target: screenKeyboard
                anchors.top: menuBar.top
                anchors.bottom: undefined
            }
            StateChangeScript {
                name: "resetKeyboard"
                script: {keyColumn.state = "default";}
            }
        }
    ]
    
    transitions: [
        Transition {
            from: "shown"; to: "hidden"
            SequentialAnimation {
                AnchorAnimation { easing.type: Easing.OutQuart; duration: 300 }    
                ScriptAction { scriptName: "resetKeyboard" }
            }
        },
        Transition {
            from: "hidden"; to: "shown"   
            AnchorAnimation { easing.type: Easing.OutQuart; duration: 300 }
    

    PropertyAnimation {target: screenKeyboard; property: "opacity"; to: 1; duration: 250}
    }
    ]
    @

    I did not find any helpful hints for the error on the internet so hopefully you can help me (I'm pretty sure the same Qml code worked with C++ Qt)


Log in to reply
 

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