title: Integration of Exposed model into ListModel QML
body: <p>I have exposed successfully a list that contain 3 integer from C++ to my main.qml
  using ListView in main.qml</p>
  <pre><code>ListView {
  width: 200; height: 250
  required model
  delegate: Text {
      required property int longitude
      required property int latitude
      required property int height_
      text: &quot;Data: &quot; + longitude + &quot;, &quot; + latitude +&quot;,&quot;+ height_
  }}
  </code></pre>
  <p><a href="https://i.stack.imgur.com/SVSAo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SVSAo.png" alt="ListView output picture" /></a></p>
  <p><strong>What I actually need to do is to integrate my C++ model into <a href="https://doc.qt.io/qt-5/qml-qtdatavisualization-itemmodelsurfacedataproxy.html" rel="nofollow noreferrer">ItemModelSurfaceDataProxy</a> that takes ListModel</strong> like this</p>
  <pre><code>   ListModel {
              id: myModel
                ListElement{ longitude: &quot;0&quot;; latitude: &quot;0&quot;; height_: &quot;124&quot;; }   
      }}
  </code></pre>
  <p>main.qml using <a href="https://doc.qt.io/qt-5/qtdatavisualization-qmlsurface-example.html" rel="nofollow noreferrer">qtdatavisualization-qmlsurface-example</a> ,,<a href="https://code.qt.io/cgit/qt/qtdatavis3d.git/tree/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml?h=5.15" rel="nofollow noreferrer">example_source_code</a></p>
  <pre><code>Rectangle {
  id: mainview
  width: 1024
  height: 768
  color: surfacePlot.theme.windowColor
  
  Item {
      id: surfaceView
      width: mainview.width
      height: mainview.height
      anchors.top: mainview.top
      anchors.left: mainview.left
      Surface3D {
          id: surfacePlot
          width: surfaceView.width
          height: surfaceView.height
          Surface3DSeries {
              id: surfaceSeries
              flatShadingEnabled: false
              drawMode: Surface3DSeries.DrawSurface
  
              ItemModelSurfaceDataProxy {
                  itemModel: myModel **// this needs to be replaced by C++ model**
                  rowRole: &quot;longitude&quot;
                  columnRole: &quot;latitude&quot;
                  yPosRole: &quot;height_&quot;
              }
              onDrawModeChanged: checkState()
          }
      }
      ListModel { **//This is the model that needs to be replaced by C++ Model**
              id: myModel
      }
    }}
  </code></pre>
  <p>main.cpp</p>
  <pre><code>   int main(int argc, char *argv[])
     {
      QGuiApplication app(argc, argv);
      AnimalModel model;
      model.addAnimal(Animal(1, 2,3));
      model.addAnimal(Animal(2,4,5));
      model.addAnimal(Animal(3,4,6));
      QQuickView viewer;
      viewer.setResizeMode(QQuickView::SizeRootObjectToView);
      viewer.setInitialProperties({{&quot;model&quot;, QVariant::fromValue(&amp;model)}});
      viewer.setSource(QUrl(&quot;qrc:/qml/qml/qmlsurface/main.qml&quot;));
      viewer.setTitle(QStringLiteral(&quot;Egyptolict &quot;));
      viewer.show();
      return app.exec();
     }
  </code></pre>
  <p>model.cpp using QT <a href="https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/quick/models/abstractitemmodel/model.cpp?h=5.15" rel="nofollow noreferrer">example</a></p>
  <pre><code>#include &quot;model.h&quot;
  Animal::Animal(const int &amp;longitude, const int &amp;latitude,const int &amp;height_)
  : m_longitude(longitude), m_latitude(latitude) ,m_height(height_){}
  
  int Animal::longitude() const{
    return m_longitude;}
  int Animal::latitude() const{
    return m_latitude;}
  int Animal::height_() const{
    return m_height;}
  AnimalModel::AnimalModel(QObject *parent)
  : QAbstractListModel(parent)
  {
   }
  void AnimalModel::addAnimal(const Animal &amp;animal)
  {
  beginInsertRows(QModelIndex(), rowCount(), rowCount());
  m_animals &lt;&lt; animal;
  endInsertRows();
  }
   int AnimalModel::rowCount(const QModelIndex &amp; parent) const {
  Q_UNUSED(parent);
  return m_animals.count();
  }
  QVariant AnimalModel::data(const QModelIndex &amp; index, int role) const {
  if (index.row() &lt; 0 || index.row() &gt;= m_animals.count())
      return QVariant();
  
  const Animal &amp;animal = m_animals[index.row()];
  if (role == longitudeRole)
      return animal.longitude();
  else if (role == latitudeRole)
      return animal.latitude();
  else if (role == heightRole)
      return animal.height_();
  return QVariant();
  }
  QHash&lt;int, QByteArray&gt; AnimalModel::roleNames() const {
  QHash&lt;int, QByteArray&gt; roles;
  roles[longitudeRole] = &quot;longitude&quot;;
  roles[latitudeRole] = &quot;latitude&quot;;
  roles[heightRole] = &quot;height_&quot;;
  return roles;
  }
  </code></pre>
  <p>model.h using qt <a href="https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/quick/models/abstractitemmodel/model.h?h=5.15" rel="nofollow noreferrer">example</a></p>
  <pre><code>#include &lt;QAbstractListModel&gt;
  #include &lt;QStringList&gt;
  class Animal
  {public:
  Animal(const int &amp;longitude, const int &amp;latitude , const int &amp;height_);
   int longitude() const;
   int latitude() const;
   int height_() const;
  private:
   int m_longitude;
   int m_latitude;
   int m_height;
    };
  
   class AnimalModel : public QAbstractListModel
   {
    Q_OBJECT
   public:
    enum AnimalRoles {
      longitudeRole = Qt::UserRole + 1,
      latitudeRole,
      heightRole
     };
  
     AnimalModel(QObject *parent = 0);
  
    void addAnimal(const Animal &amp;animal);
   int rowCount(const QModelIndex &amp; parent = QModelIndex()) const;
   QVariant data(const QModelIndex &amp; index, int role = Qt::DisplayRole) const;
   QHash&lt;int, QByteArray&gt; roleNames() const;
   private:
    QList&lt;Animal&gt; m_animals;
    };
  </code></pre>