Cannot assign to non-existent property "states" (solved)

  • Trying to use state in QML.
    getting error: cannot assign to non-existent property "states".
    Please help

    import QtQuick 2.2
    import QtQuick.window 2.1
    window {

           id: myRect
        State {
                        name: "moved"
                        PropertyChanges { target:myRect;   x:50   y:50   }


  • what is "window"?
    maybe you should use "Window" ?
    QML is case sencetive...

  • @maxim.prishchepa Sorry to resurrect this thread after so long, but I believe this should not work even if the Window is spelled correctly. The thing is that I believe you cannot use states with Window object at all (although it is not mentioned anywhere in the documentation, which really drives me nuts, cause I just wasted a lot of time trying to find out). How come the thread is marked as solved even though it has no final answer?

  • That's right, I think states doesn't work in Window. I learned the hard way as well but does anyone know why it doesn't work?

Log in to reply

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