<?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[updating &quot;text object&quot; setPropery...]]></title><description><![CDATA[<p dir="auto">원본 텍스트<br />
I am trying to change a parameter in my qml file from c++ using the following code:</p>
<p dir="auto">QQmlApplicationEngine engine;<br />
engine.load(QUrl(QLatin1String("qrc:/Window.qml")));</p>
<p dir="auto">QObject <em>text;<br />
text = engine.rootObjects().first()-&gt;findChild&lt;QQuickItem</em>&gt;("objectText");</p>
<p dir="auto">qDebug()&lt;&lt;"Before : "&lt;&lt;text-&gt;property("text");<br />
QQmlProperty::write(text, "text", QVariant("Change"));<br />
qDebug()&lt;&lt;"After : "&lt;&lt;text-&gt;property("text");</p>
<p dir="auto">The debugger gives the output I want.. but the gui isn't updating and stays at the last value. Is there a way to update the gui?</p>
]]></description><link>https://forum.qt.io/topic/127864/updating-text-object-setpropery</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 05:40:38 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/127864.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Jun 2021 11:37:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to updating &quot;text object&quot; setPropery... on Thu, 24 Jun 2021 19:58:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/grecko">@<bdi>GrecKo</bdi></a> said in <a href="/post/667100">updating "text object" setPropery...</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sierdzio">@<bdi>sierdzio</bdi></a> as knowledgeable users, I believe we shouldn't foster beginners' bad practices but bring them back in the right track.</p>
</blockquote>
<p dir="auto">How should I know if it is a beginner? I've seen something like this used to do real magic in a project, and my tough experts.</p>
<p dir="auto">In general, yes you're right, it is not "the way" to do things in QML projects. But it's not forbidden, and maybe could be useful in some certain edge cases.</p>
]]></description><link>https://forum.qt.io/post/667181</link><guid isPermaLink="true">https://forum.qt.io/post/667181</guid><dc:creator><![CDATA[sierdzio]]></dc:creator><pubDate>Thu, 24 Jun 2021 19:58:49 GMT</pubDate></item><item><title><![CDATA[Reply to updating &quot;text object&quot; setPropery... on Thu, 24 Jun 2021 13:25:51 GMT]]></title><description><![CDATA[<p dir="auto">Did you create 2 QQmlApplicationEngine and load your qml file twice?</p>
<p dir="auto">Also you should not modify your QML object from c++.</p>
<p dir="auto"><a href="https://doc.qt.io/qt-5/qtquick-bestpractices.html#interacting-with-qml-from-c" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qtquick-bestpractices.html#interacting-with-qml-from-c</a><br />
<a href="http://doc.qt.io/qt-5/qtqml-cppintegration-overview.html#interacting-with-qml-objects-from-c" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qtqml-cppintegration-overview.html#interacting-with-qml-objects-from-c</a><br />
<a href="https://youtu.be/vzs5VPTf4QQ?t=23m20s" target="_blank" rel="noopener noreferrer nofollow ugc">https://youtu.be/vzs5VPTf4QQ?t=23m20s</a></p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sierdzio">@<bdi>sierdzio</bdi></a> as knowledgeable users, I believe we shouldn't foster beginners' bad practices but bring them back in the right track.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lisp">@<bdi>LISP</bdi></a> expose a QObject subclass with a QString Q_PROPERTY and bind to that in your objectText object from QML.<br />
When you want to change the text, change the property and emit its notify signal and the QML side will get automatically updated.</p>
]]></description><link>https://forum.qt.io/post/667100</link><guid isPermaLink="true">https://forum.qt.io/post/667100</guid><dc:creator><![CDATA[GrecKo]]></dc:creator><pubDate>Thu, 24 Jun 2021 13:25:51 GMT</pubDate></item><item><title><![CDATA[Reply to updating &quot;text object&quot; setPropery... on Thu, 24 Jun 2021 06:28:43 GMT]]></title><description><![CDATA[<p dir="auto">Are you sure your <code>text</code> emits a signal when <code>"text"</code> property is changed?</p>
]]></description><link>https://forum.qt.io/post/667004</link><guid isPermaLink="true">https://forum.qt.io/post/667004</guid><dc:creator><![CDATA[sierdzio]]></dc:creator><pubDate>Thu, 24 Jun 2021 06:28:43 GMT</pubDate></item><item><title><![CDATA[Reply to updating &quot;text object&quot; setPropery... on Thu, 24 Jun 2021 06:20:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sierdzio">@<bdi>sierdzio</bdi></a></p>
<p dir="auto">Thank you sir!<br />
text.setProperty("text", "Change");<br />
This is the first method I've used, but still no response.<br />
Will others be updated right away?</p>
]]></description><link>https://forum.qt.io/post/667003</link><guid isPermaLink="true">https://forum.qt.io/post/667003</guid><dc:creator><![CDATA[LISP]]></dc:creator><pubDate>Thu, 24 Jun 2021 06:20:07 GMT</pubDate></item><item><title><![CDATA[Reply to updating &quot;text object&quot; setPropery... on Thu, 24 Jun 2021 05:22:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lisp">@<bdi>LISP</bdi></a> said in <a href="/post/666860">updating "text object" setPropery...</a>:</p>
<blockquote>
<p dir="auto">QQmlProperty::write(text, "text", QVariant("Change"));</p>
</blockquote>
<p dir="auto">Use QObject instead:</p>
<pre><code>text.setProperty("text", "Change");
</code></pre>
]]></description><link>https://forum.qt.io/post/666991</link><guid isPermaLink="true">https://forum.qt.io/post/666991</guid><dc:creator><![CDATA[sierdzio]]></dc:creator><pubDate>Thu, 24 Jun 2021 05:22:11 GMT</pubDate></item></channel></rss>