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. Reference Error: mapToItem is not defined
Forum Updated to NodeBB v4.3 + New Features

Reference Error: mapToItem is not defined

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 253 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
    mitrovicl
    wrote on last edited by
    #1

    This is the code:

    var pnt = mapToItem(player, food.x, food.y);
    

    I'm getting Reference Error: mapToItem is not defined.
    I guess I have to include something, but I'm not sure what and where?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      mapToItem() is a function of Item component - so you need to specify an object. Example:

      Rectangle {
        id: foo
      }
      
      function getPoint() {
        let pnt = foo.mapToItem(player, food.x, food.y)
        return pnt
      }
      

      (Z(:^

      1 Reply Last reply
      2

      • Login

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