Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Cannot assign to non-existent property "states" (solved)

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

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 4 Posters 5.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    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
           visible:true
           width:350
           height:350
           color:"red"
    
    
          MouseArea{
                     anchors.fill:parent
                     onClicked:myRect.state="moved"
                             }
        states:[
        State {
                        name: "moved"
                        PropertyChanges { target:myRect;   x:50   y:50   }
                  }
                  ]
    

    @

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maxim.prishchepa
      wrote on last edited by
      #2

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

      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz).

      A 1 Reply Last reply
      0
      • M maxim.prishchepa

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

        A Offline
        A Offline
        Aros
        wrote on last edited by
        #3

        @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?

        1 Reply Last reply
        0
        • X Offline
          X Offline
          xalam
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved