title: Show, change data and keep QQmlListProperty in qml
body: <p>in the past i resolved a problem with QQmlListProperty for expose c++ qlist to qml, and the problem was resolved, now i try use their solution again, but i can't.
  the first time the list exposed to qml every time are different, this time no, i have a Qlist in a main class, and many data from her are loaded from db, and others changed in runtime.</p>
  
  <p>When the application start, the load of data  and exposed to Qml is ok,  i need change of page(gui) and keep the data stored in program and probably used many of their data in other guis (as text), and every time i change of page (with loader element) the program crashes, i believe a directions of pointers are changed in qml when the data from c++ class is copied to gui in qml. 
  My Code from QmlListproperty class and method of Load data in qml, and copy from the main qml to page.</p>
  
  <p>definition of class ListBombsUi.h"</p>
  
  <pre><code> #include "StructBombUi.h"
  
   class ListBombsUi: public QObject{
     Q_OBJECT
     Q_PROPERTY(QQmlListProperty&lt;CStructBombUi&gt;  bombsUi READ bombsUiList NOTIFY      bombsUiChanged);
     Q_CLASSINFO("DefaultProperty", "bombsUi");
    public:
     ListBombsUi(QObject *parent=0);
     QQmlListProperty&lt;CStructBombUi&gt; bombsUiList(); 
  
     static void appendBombUi(QQmlListProperty&lt;CStructBombUi&gt; *list, CStructBombUi *pdt);
     static void clear(QQmlListProperty&lt;CStructBombUi&gt; *property);
     static int listSize(QQmlListProperty&lt;CStructBombUi&gt; *property);
     static CStructBombUi *bombUiAt(QQmlListProperty&lt;CStructBombUi&gt; *property, int index);
  
     void addBomb(CStructBombUi *bombUi);
     Q_INVOKABLE int size();
     void Q_INVOKABLE getMemory();
     Q_INVOKABLE void clearList();
     CStructBombUi* getValue(int index) const;
  
     QList&lt;CStructBombUi *&gt; copyList();
  
    signals:
     void bombsUiChanged();
  
    public:
     int lastAdded;
  
    private:
     CStructBombUi *item;
  
     QList&lt;CStructBombUi*&gt; m_BombsUi;
  </code></pre>
  
  <p>i register how qmltype</p>
  
  <pre><code>qmlRegisterType&lt;ListBombsUi&gt;("BombsListUiModel", 1, 0, "ListBombsUi");
  </code></pre>
  
  <p>definition of main methods of ListBombsUi</p>
  
  <pre><code>ListBombsUi::ListBombsUi(QObject *parent):QObject(parent)
  {}
  
  QQmlListProperty&lt;CStructBombUi&gt; ListBombsUi::bombsUiList() 
  {
     return QQmlListProperty&lt;CStructBombUi&gt;(this, &amp;m_BombsUi, &amp;ListBombsUi::appendBombUi,
                   &amp;ListBombsUi::listSize,
                   &amp;ListBombsUi::bombUiAt,
                   &amp;ListBombsUi::clear);
  
     emit bombsUiChanged();
  }
  
  
   void ListBombsUi::appendBombUi(QQmlListProperty&lt;CStructBombUi&gt; *list, CStructBombUi *pdt)
   {
      ListBombsUi *bombsList= qobject_cast&lt;ListBombsUi *&gt;(list-&gt;object);
  
      if(bombsList)   {
        pdt-&gt;setParent(bombsList);
        bombsList-&gt;m_BombsUi.append(pdt);
        bombsList-&gt;bombsUiChanged();
      }
   }
  
  
    void ListBombsUi::clearList()
    {
      m_BombsUi.clear();
      emit bombsUiChanged();
    }
  
    void ListBombsUi::addBomb(CStructBombUi *bombUi)
    {
      m_BombsUi.append(bombUi);
      emit bombsUiChanged();
    }
  </code></pre>
  
  <p>definition in main class for two data, i use the first as aux, but is possible use the second directly(their are my idea originallly)</p>
  
  <pre><code>QList&lt;CStructBombUi * &gt; listBombs;
  ListBombsUi *listBufferBombs;  
  </code></pre>
  
  <p>i assign a listBufferBombs to element in qml</p>
  
  <pre><code>listBufferBombs = mainObject-&gt;findChild&lt;ListBombsUi*&gt;("listGralBombs");
  </code></pre>
  
  <p>method for expose data to qml</p>
  
  <pre><code> void EgasWindowWork::setDataOfBombsInModels()//, const QList &lt;CEstrucBombUi&gt; *const    dataArrayBombs)
   { 
  
     if( (mainObject) ) {
  
        CStructBombUi e,k,j;
  
        e.initializing(QStringList()&lt;&lt;"text1"&lt;&lt;"text2"&lt;&lt;"text3");
        e.update(QString("15"), QString("1"), QString("1"), QString("1"),QString("1"));
  
        k.initializing(QStringList()&lt;&lt;"text1"&lt;&lt;"text2");
        k.update(QString("2"), QString("2"), QString("2"), QString("2"),QString("2"));
  
        listBombs.append(&amp;e);
        listBombs.append(&amp;k);
  
        for(qint16 i=0; i&lt;listBombs.size() ; i++)
           {  listBufferBombs-&gt;addBomb( listBombs.value(i) );   }
  
        QMetaObject::invokeMethod(mainObject, "setDataOfModelBombs"); //this method copy the list located in main qml for page
   }
  </code></pre>
  
  <p>the metod in main.qml file</p>
  
  <pre><code>function setDataOfModelBombs()
  {  
      if(itemOfPageLoaded)   {   
          itemOfPageLoaded.listBombs=listed
          itemOfPageLoaded.setDataOfBombs() //this function put every data inside the every field of qml gui element
      }
   }
  </code></pre>
  
  <p>declaration of loader element in main.qml file</p>
  
  <pre><code>Loader{
      id: pageLoader
      focus: true
      //anchors.horizontalCenter: parent.horizontalCenter
      width: parent.width
      height: parent.height-50
      anchors.top: headerIcons.bottom
      objectName: "switchPages"
      z: 2
      source: "BombsUi.qml"
      property bool valid: item !== null
  
      Binding {
          target: pageLoader.item
          property: "numberBombs"
          value: numberOfBombs
          when: pageLoader.status == Loader.Ready
      }
  
  }
  </code></pre>
  
  <p>method in qml file loaded as page</p>
  
  <pre><code>function setDataOfBombs()
  {
      var size=newList.size()
      arrayBombs.model=size //i use a repater container, and model is the number of elements loaded
  
      if(size&gt;0) {
          for(var i=0; i&lt;size; i++) {
          //exactly in the next line the error happens
              arrayBombs.itemAt(i).priceText=newList.bombsUi[i].ultimateProductPrice
              arrayBombs.itemAt(i).volumeText = newList.bombsUi[i].ultimateProductVolume
              //exist mor date, but with this are sufficient
           }
       }
   }
  </code></pre>
  
  <p>and here is declaration of element repeater-grid</p>
  
  <pre><code>   Item{
      width: parent.width; height: parent.height
  
      Item{
          id: bombsArea
          height: parent.height; width: parent.width*0.7
          anchors.leftMargin: 10
          y: 3
          x: 2
          Grid{
              id: gridOfBombsModel
              width: parent.width; height: parent.height
              spacing: 7
              rows: 6; columns: Math.round((parent.width/165))
              Repeater{
                  id: arrayBombs
  
                  BombModel{
                      numberBomb: (index + 1)
                      MouseArea{
                          anchors.fill: parent
                          onClicked:{
                              parent.borderProperties.color="red"
                              parent.borderProperties.width=1.5
                          }
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>the program load the page 1 ok, but i change a page "n" and return to page 1, crashes. i accept alternatives to, Thanks for your help.</p>