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. [SOLVED] QML Qt.createQmlObject how to refer variable
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QML Qt.createQmlObject how to refer variable

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.5k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    michall_l
    wrote on 8 May 2013, 11:42 last edited by
    #1

    Hi all. I have a QML & JavaScript code:
    @ Grid {
    columns: 4
    y: 50
    id: grid
    spacing: 50
    function pokaz() {
    for(var j = 0; j < 5; j++) {
    Qt.createQmlObject('import com.nokia.meego 1.1; Label {text: wydatek.nazwa(j)}', grid, '');
    Qt.createQmlObject('import com.nokia.meego 1.1; Label {text: wydatek.cena(j)}', grid, '');
    Qt.createQmlObject('import com.nokia.meego 1.1; Label {text: wydatek.sztuk(j)}', grid, '');
    Qt.createQmlObject('import com.nokia.meego 1.1; Label {text: wydatek.data(j)}', grid, '');
    }
    }
    Component.onCompleted: pokaz();
    }@
    I can't to refer 'j' value. I have a log:
    @ <Unknown File>:1: ReferenceError: Can't find variable: j@
    Question is: How can I refer the 'j' value? How I do wrong?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 8 May 2013, 11:58 last edited by
      #2

      @
      'import com.nokia.meego 1.1; Label {text: wydatek.nazwa(' + j + ')}'
      @

      (Z(:^

      1 Reply Last reply
      0
      • M Offline
        M Offline
        michall_l
        wrote on 10 May 2013, 19:21 last edited by
        #3

        Thanks:)

        1 Reply Last reply
        0

        3/3

        10 May 2013, 19:21

        • Login

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