title: Create function that returns a QList<int>
body: <p>Coming from a C# background, I have some habbits that need to be changed.  I'm tring to return a QList&lt;int&gt; from a function.  The compiler error message is conversion from 'QList*' to non-scalar type 'QList' requested.  Here is the function:</p>
  
  <pre><code>QList&lt;int&gt; toCategories(QVariant qv)
  {
      QList&lt;int&gt;categories = new QList&lt;int&gt;();
      if(qv.isValid() &amp;&amp; qv.type() == QVariant::List)
      {
          foreach(QVariant category,qv.toList()){
              categories.append(category.toInt() );
          }
      }
      return categories;
  }
  </code></pre>
  
  <p>I'd appreciate a link to the documentation or a function using the correct syntax</p>