<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QML does not recognize ENUM returned by C++ Q_INVOKABLE function]]></title><description><![CDATA[<p dir="auto">QML</p>
<pre><code>console.log("model's category is " + converter.getModelCategory(currentIndex))
</code></pre>
<p dir="auto">C++</p>
<pre><code>Q_INVOKABLE Unit::Category getModelCategory(int index) { //TODO put in separate file
    qDebug() &lt;&lt; "getModelCategory is called, Index is " &lt;&lt; index;
    return qobject_cast&lt;Unit *&gt;(CategoryDataModel.at(index))-&gt;category();
}
</code></pre>
<p dir="auto">error<br />
<code>: Error: Unknown method return type: Unit::Category</code> where <code>Unit::Category</code> is C++ enums and it is declared with <code>Q_ENUM</code>. However, <code>Unit::Category</code> is declared in other QOBJECT derived class, might it be a problem?<br />
How to solve this issue?</p>
]]></description><link>https://forum.qt.io/topic/60059/qml-does-not-recognize-enum-returned-by-c-q_invokable-function</link><generator>RSS for Node</generator><lastBuildDate>Thu, 15 Oct 2026 07:45:08 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/60059.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Oct 2015 17:04:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QML does not recognize ENUM returned by C++ Q_INVOKABLE function on Wed, 28 Oct 2015 07:52:55 GMT]]></title><description><![CDATA[<p dir="auto">As far as I know,  "Unit" type need to register throgh qmlRegisterType to make "Unit::Category" visible in QML.</p>
]]></description><link>https://forum.qt.io/post/295431</link><guid isPermaLink="true">https://forum.qt.io/post/295431</guid><dc:creator><![CDATA[luosen]]></dc:creator><pubDate>Wed, 28 Oct 2015 07:52:55 GMT</pubDate></item></channel></rss>