Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Accessing Qlist within a Qlist and Deallocating them through Qml
Qt 6.11 is out! See what's new in the release blog

Accessing Qlist within a Qlist and Deallocating them through Qml

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.5k 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.
  • S Offline
    S Offline
    sruthihsr
    wrote on last edited by
    #1

    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

    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