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. Transform property id
Qt 6.11 is out! See what's new in the release blog

Transform property id

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 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.
  • P Offline
    P Offline
    petzold
    wrote on last edited by
    #1

    Hi,

    is it possible to transform the id of an qml element to a string?
    I tried it with valueOf but then the log give the error: ReferenceError: Can't find variable: id
    Is there a possiblity to access the id value?

    example:
    @
    Rectangle {
    id: rect99
    objectName: valueOf(id)
    @

    1 Reply Last reply
    0
    • JKSHJ Online
      JKSHJ Online
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      id is a special "attribute":http://doc.qt.io/qt-5/qtqml-syntax-objectattributes.html (it is not a property). It acts as a reference to the object only; you cannot "read" the value of an id, unfortunately.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        the id works a lot like a named pointer, but without having the this keyword available.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          petzold
          wrote on last edited by
          #4

          Ok, i hoped that there is a special trick or something to access the value.

          Thanks you both

          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