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] Find a quick item by name
Forum Updated to NodeBB v4.3 + New Features

[solved] Find a quick item by name

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.2k 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.
  • J Offline
    J Offline
    jduran
    wrote on last edited by
    #1

    Dear all,

    I've read that from C++ is possible to find a QuickItem by name http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-interactqmlfromcpp.html. But, is it possible to find an item by name in Quick Object? That is from a Rectangle or from an Item?

    @
    Rectangle {
    [...]
    var child = find("object name");
    [...]
    }
    @

    Joaquim Duran

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

      In QML you can usually just use the ID.

      All QObject properties are still available, so you can still find it through:
      @
      for (var i = 0; i < parent.children.length; ++i) {
      if (parent.children[i].objectName === "object name") {
      // BINGO :)
      }
      }
      @

      (Z(:^

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jduran
        wrote on last edited by
        #3

        Thanks

        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