Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Access items in Grid from C++ code



  • Hello everyone,
    Is there a way in Qt to access items (added with repeater) in Grid from C++ code?
    If there is no way to do so or is considered to be a bad practice, would you please suggest an alternative?

    Thanks))


  • Qt Champions 2016

    findChild() do not works with Repeater. You need to call itemAt() to get specific children from Repeater.

    For example:

                QQuickItem* child;
                QMetaObject::invokeMethod(repeater,"itemAt",Qt::DirectConnection,
                                          Q_RETURN_ARG(QQuickItem*,child),
                                          Q_ARG(int,i));
    


  • Thanks for your reply.