How to get a valid instance of a QQuickItem on C++ side

后端 未结 2 442
逝去的感伤
逝去的感伤 2021-01-21 18:51

Alright. I have searched a lot but haven\'t got a good solution yet. I am new to Qt. I have a class which is a QQuickItem like so,

clas         


        
2条回答
  •  半阙折子戏
    2021-01-21 19:15

    Doing the following from a suggestion in discussion here solves the issue & gets a valid object to the QuickItem qml file

    QQuickItem *myItem = engine.rootObjects()[0]->findChild("myQuickItem");
    

提交回复
热议问题