<?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[No QML error when property missing from Q_GADGET]]></title><description><![CDATA[<p dir="auto">I have a Q_GADGET C++ object for a bunch of properties that I expose to QML. In a recent refactor I inadvertently removed the Q_PROPERTY specification for one of the properties I wanted to expose.</p>
<p dir="auto">This led to some unusual behaviour in the UI as the property was used in some logic to determine whether to show a particular entry in a popup menu. Although I have fixed it by re-exposing the property, I am baffled that there was not more of a run-time failure from QML. The code is something like this:</p>
<pre><code>    ...
    if (data.isCopyEnabled)  // &lt;&lt;&lt;&lt; isCopyEnabled not exposed from gadget
       ... // add "Copy" entry to menu
    if (data.isDeleteEnabled)
       ... // add "Delete" entry to menu
    ...
    menu.open();
}
</code></pre>
<p dir="auto">I have things set up so that I see QML runtime warnings in my console, and I see nothing there when this executes. Also, it is clear that execution continues over the <code>data.isCopyEnabled</code> check because the other entry is added and the popup is shown. The behaviour is as if <code>isCopyEnabled</code> is false.</p>
<p dir="auto">Is this expected behaviour? I am sure I have seen more noisy behaviour of one type or another in the past when I have attempted to access an attribute that does not exist on a C++ object exposed to QML.</p>
]]></description><link>https://forum.qt.io/topic/164743/no-qml-error-when-property-missing-from-q_gadget</link><generator>RSS for Node</generator><lastBuildDate>Mon, 22 Jun 2026 02:40:20 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164743.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Jun 2026 09:41:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to No QML error when property missing from Q_GADGET on Wed, 03 Jun 2026 09:46:15 GMT]]></title><description><![CDATA[<p dir="auto"><code>gadget.nonExistentProperty</code> will evaluate to <code>undefined</code> so that's not a runtime error or warning.</p>
<p dir="auto">I believe qmllint would flag this though.</p>
]]></description><link>https://forum.qt.io/post/838538</link><guid isPermaLink="true">https://forum.qt.io/post/838538</guid><dc:creator><![CDATA[GrecKo]]></dc:creator><pubDate>Wed, 03 Jun 2026 09:46:15 GMT</pubDate></item></channel></rss>