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

Accessing Qlist within a Qlist and Deallocating them through Qml



  • Hi All,
    I have the following classes
    @
    class SourceSinkObj : public QObject
    {
    Q_OBJECT
    Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
    Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged)
    }
    @
    and
    @
    class ListofLists : public SourceSinkObj
    {
    Q_OBJECT
    Q_PROPERTY(quint32 ID READ ID WRITE setID NOTIFY IDChanged)
    Q_PROPERTY( QList<SourceSinkObj*> sublist READ sublist WRITE setsublist
    @
    In my main .cpp
    I have the following where listSinkClasses is a Vector
    @
    QList<ListofLists*> SinkMasterlist;
    for (int i=0 ;i < listSinkClasses.size() ;i++)
    {
    am_SinkClass_s tempSinkClass;
    tempSinkClass= listSinkClasses.at(i);
    ListofLists* TempSinkMaster = new ListofLists();
    quint32 TempID= tempSinkClass.SinkClassID;
    TempSinkMaster->setID(TempID);
    SinkMasterlist.append(TempSinkMaster);

    }
    @

    Please let me know
    1 How do i iterate through the Qlist in Qml
    2.How do i deallocate memory on button click in qml. As the function to deallocate would be in main .cpp I can not use Q_INVOKABLE

    Thanks and Regards


Log in to reply