<?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[Cannot assign to property of a property alias in reusable component]]></title><description><![CDATA[<p dir="auto">I'm trying to assign value to <code>content.padding</code> , where <code>content</code> is a property alias from <code>MyButton.qml</code> and <code>padding</code> is a property of <code>content</code>. However, the complier shows <em>Cannot assign to non-existent property padding</em>, which confused me a lot.</p>
<pre><code>import QtQuick
import QtQuick.Controls
Window{
    MyButton {
        content.padding: 10
    }
}

// MyButton.qml
import QtQuick
import QtQuick.Controls
Rectangle {
    property alias content: content
    Rectangle{
        id: content
        property int padding: 0
    }
}
</code></pre>
]]></description><link>https://forum.qt.io/topic/146168/cannot-assign-to-property-of-a-property-alias-in-reusable-component</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 02:17:07 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/146168.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Jul 2023 06:23:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cannot assign to property of a property alias in reusable component on Mon, 03 Jul 2023 08:38:39 GMT]]></title><description><![CDATA[<p dir="auto">I believe this a  defect, at least, it should be fixed in future. The only way to assign property from a property alias is assigning in runtime. Do as follows:</p>
<pre><code>MyButton {
     Component.onCompleted: content.padding = 10
}
</code></pre>
]]></description><link>https://forum.qt.io/post/763415</link><guid isPermaLink="true">https://forum.qt.io/post/763415</guid><dc:creator><![CDATA[Kamichanw]]></dc:creator><pubDate>Mon, 03 Jul 2023 08:38:39 GMT</pubDate></item><item><title><![CDATA[Reply to Cannot assign to property of a property alias in reusable component on Mon, 03 Jul 2023 07:26:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sierdzio">@<bdi>sierdzio</bdi></a> I tried your solution,  but it doesn't work.</p>
]]></description><link>https://forum.qt.io/post/763407</link><guid isPermaLink="true">https://forum.qt.io/post/763407</guid><dc:creator><![CDATA[Kamichanw]]></dc:creator><pubDate>Mon, 03 Jul 2023 07:26:36 GMT</pubDate></item><item><title><![CDATA[Reply to Cannot assign to property of a property alias in reusable component on Mon, 03 Jul 2023 07:19:17 GMT]]></title><description><![CDATA[<p dir="auto">Maybe the double-naming gets confusing for QML engine? Try this:</p>
<pre><code>property alias content: contentInternal
    Rectangle{
        id: contentInternal
</code></pre>
]]></description><link>https://forum.qt.io/post/763403</link><guid isPermaLink="true">https://forum.qt.io/post/763403</guid><dc:creator><![CDATA[sierdzio]]></dc:creator><pubDate>Mon, 03 Jul 2023 07:19:17 GMT</pubDate></item></channel></rss>