0

How can one find an element in qml by objectName or id? I want to implement similar functionality

Item {
    id: myItem
}
MyItemClass {
   onStart: {
      myclass.add_new_obj (myItem.toString)
   }
   onJobDone: {
       item_qml_id.width = width_qml
       // here item_qml_id = Item_QMLTYPE_111(0x1ee54f12312), can i find object using this value?
   }
}

My signal in c++ looks like:

void jobDone(QString item_qml_id, int width_qml)
JarMan
  • 7,589
  • 1
  • 10
  • 25
  • Please provide more details or write more code. – SajadBlog Jan 28 '21 at 07:58
  • Very close to https://stackoverflow.com/questions/31206813/how-to-find-qml-item-by-its-string-id Please read over there (and try to search before posting) – Amfasis Jan 28 '21 at 08:14
  • As far as I understand what you need is sending id from c++ to qml. `id` in qml equivalent to `QObject*` in c++. They are auto convertible. – Kao Jan 28 '21 at 08:14

0 Answers0