title: Create ListView/ListModel from a vector of strings
body: <h2>Prologue</h2>
  
  <p><a href="https://doc.qt.io/qt-5/qabstractlistmodel.html" rel="nofollow noreferrer">QAbstractListModel</a> might be a solution, but I think it is a bit overkill for me ... not sure</p>
  
  <h2>Intro</h2>
  
  <p>I'm making a vector inside C++ to be accessible from within QML:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>class MyClass : public QObject
  {
      Q_OBJECT
      Q_PROPERTY(QVector&lt;QString&gt; items READ items WRITE setItems NOTIFY itemsChanged)
      // ...
  }
  </code></pre>
  
  <p>As I have tested, I can access my vector from within QML:</p>
  
  <pre><code>console.log("myClass.items &gt;&gt;&gt; ", myClass.items) // Logs vector of strings
  </code></pre>
  
  <hr>
  
  <h2>Question</h2>
  
  <p>On my QML UI, I intend to show a list of the strings inside the vector. I try to use <code>ListModel</code> and <code>ListView</code> but I don't know how to do it. Can anybody help?</p>
  
  <pre><code>    ListModel {
          id: myListModel
          // How to compose my model here according to vector of strings
          // i.e. myClass.items
      }
  
      ListView {
          model: myListModel
          delegate: {
              // ... show the strings inside the vector
          }
      }
  </code></pre>
  
  <hr>
  
  <h2>UPDATE</h2>
  
  <p>As suggested by @Amfasis and @mohabouje, I modified my code like this, but it is <strong>not</strong> working for some reason.</p>
  
  <p>C++ side:</p>
  
  <pre><code>class MyClass : public QObject
  {
      Q_OBJECT
      Q_PROPERTY(QStringList items READ items WRITE setItems NOTIFY itemsChanged)
      //...
  }
  </code></pre>
  
  <p>QML side:</p>
  
  <pre><code>            Row {
                  ListView {
                      id: items
                      model: myClass.items // Directly connect to C++ string list
                      delegate: Text {
                          text: modelData // Strings are NOT displayed on QML UI
                                          // Log of modelData shows it is empty
                      }
                  }
              }
  </code></pre>
  
  <p>On QML I log <code>myClass.items</code> and I see my string list:</p>
  
  <pre><code>console.log("myClass.items &gt;&gt;&gt; ", myClass.items)
  // logs:
  // qml: myClass.items &gt;&gt;&gt;  [item 0,item 1,item 2]
  </code></pre>
  
  <h2>Finally Fixed</h2>
  
  <p>When setting or modifying items, I need to <code>emit</code> the modification signal otherwise it won't work:</p>
  
  <pre><code>m_items = /* set items here */;
  emit itemsChanged(m_items); // This is required!
  </code></pre>