Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-13259

Can't access javascript objects' properties

    XMLWordPrintable

Details

    Description

      I'm not sure if this is a bug or a known limitation. If latter then please assign this to the documentation project and ask them to mention the limitation here: http://doc.qt.nokia.com/4.7-snapshot/qdeclarativejavascript.html#qml-javascript-restrictions

      import Qt 4.7
      
      Rectangle {
          width: 600
          height: 600
      
          property variant a
      
          Component.onCompleted: {
              a = {"name":"arska","occupation":"baker"};
              console.log(a);
              console.log(a.name);
              console.log(a['name']);
           }
      }
      

      The output is:

      [object Object]
      undefined
      undefined

      instead of the expected:

      [object Object]
      arska
      arska

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            aakenned Aaron Kennedy
            juturune Juha Turunen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes