November 23, 2011

sruthihsr sruthihsr
Lab Rat
21 posts

Accessing Qlist within a Qlist and Deallocating them through Qml

 

Hi All,
I have the following classes

  1. class SourceSinkObj : public QObject
  2. {
  3.     Q_OBJECT
  4.     Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
  5.     Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged)
  6. }

and
  1. class ListofLists : public SourceSinkObj
  2. {
  3.     Q_OBJECT
  4.     Q_PROPERTY(quint32 ID READ ID WRITE setID NOTIFY IDChanged)
  5.     Q_PROPERTY(  QList<SourceSinkObj*> sublist READ sublist WRITE setsublist

In my main .cpp
I have the following where listSinkClasses is a Vector
  1. QList<ListofLists*> SinkMasterlist;
  2. for (int i=0 ;i < listSinkClasses.size() ;i++)
  3. {
  4.     am_SinkClass_s tempSinkClass;
  5.     tempSinkClass= listSinkClasses.at(i);
  6.     ListofLists* TempSinkMaster = new  ListofLists();
  7.     quint32 TempID= tempSinkClass.SinkClassID;
  8.     TempSinkMaster->setID(TempID);
  9.     SinkMasterlist.append(TempSinkMaster);
  10.  
  11. }

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

0 replies

 
  ‹‹ add my Custom Widgets in Qt app through VS 2008      Inserting QComboBox in the HorizontalHeader of the QTableWidget ››

You must log in to post a reply. Not a member yet? Register here!