title: How to expose list of custom objects with Q_PROPERTY
body: <p>I have a very simple class with 2 properties; key and value:</p>
  
  <p><strong>KeyValue.h:</strong></p>
  
  <pre><code>class KeyValue : public QObject
  {
    Q_OBJECT
    Q_PROPERTY(QString key READ getKey WRITE setKey NOTIFY keyChanged)
    Q_PROPERTY(QString value READ getValue WRITE setValue NOTIFY valueChanged)
  
   public:
    KeyValue(const QString&amp; key, const QString&amp; value, QObject* parent = 0);  
  
   signals:
    void keyChanged();
    void valueChanged();
  
   private:
    QString _key;
    QString _value;
  
    QString getKey() const;
    QString getValue() const;
  
    void setKey(const QString&amp; key);  
    void setValue(const QString&amp; value);
  };
  Q_DECLARE_METATYPE(KeyValue)
  </code></pre>
  
  <p>In another class I would like a property containing a list of KeyValue objects, so I can use this list as a model in QML.</p>
  
  <p><strong>Controller.h</strong></p>
  
  <pre><code>class Controller : public QObject
  {
    Q_OBJECT
    Q_PROPERTY(QList&lt;KeyValue*&gt; items READ getItems NOTIFY itemsChanged)
  
   public:
    explicit Controller(QObject* parent = 0);
  
   signals:
    void itemsChanged(); 
  
   private:
    QList&lt;KeyValue*&gt; getItems() const;
  };
  </code></pre>
  
  <p>I want to be able to use this in QML the following way:</p>
  
  <pre><code>import QtQuick 2.7
  import customqml 1.0
  
  Item{
    Controller{
      id: controller
    }
    Repeater{
      model: controller.items
      Text{
        text: modelData.key + ": " + modelData.value
      }
    }
  }
  </code></pre>
  
  <p>Both classes are registered in my main.cpp file:</p>
  
  <pre><code>qmlRegisterType&lt;KeyValue&gt;("customqml", 1, 0, "KeyValue");
  qmlRegisterType&lt;Controller&gt;("customqml", 1, 0, "Controller");
  </code></pre>
  
  <p>The above code does not work, bacause I apparently can't expose a QList to QML directly. I have tried using QAbstractItemModel and QQmlListProperty, but I was unable to get it to work. Can anyone point me in the right direction?</p>
  
  <p>My primary issues are the type of the <em>items</em> property in the Controller class and the return value of the <em>getItems</em> method.</p>
  
  <p>I'm using Qt 5.9 if that makes any difference. </p>