<?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[How to get value from another qml]]></title><description><![CDATA[<p dir="auto">Hello everyone!<br />
I have 2 qml files:<br />
<code>main.qml</code> that contains <code>StackView</code> and loader of another file:</p>
<pre><code>Loader {
        id: serportLoader
        active: false
        source: "serialport-view.qml"
    }
</code></pre>
<p dir="auto">On button pressing I push this file to stack:</p>
<pre><code>serportLoader.active = true;
stackView.push(serportLoader.item);
</code></pre>
<p dir="auto">The second qml looks like this:</p>
<pre><code>ColumnLayout {
    SerialPortHandler {
        id: portHandler
        property bool isPortOpened: false
...
</code></pre>
<p dir="auto">So, can I somehow get a value of <code>isPortOpened</code> of the <code>portHandler</code> object?</p>
<p dir="auto">With <code>console.log(serportLoader.item.portHandler.isPortOpened);</code> I get <code>TypeError: Cannot read property 'isPortOpened' of undefined</code>.</p>
<p dir="auto">I just want to get result of the work from the second qml file. Perhaps can you advise a better approach?<br />
Thanks in advance!</p>
]]></description><link>https://forum.qt.io/topic/145766/how-to-get-value-from-another-qml</link><generator>RSS for Node</generator><lastBuildDate>Mon, 02 Nov 2026 08:18:51 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/145766.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Jun 2023 14:45:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to get value from another qml on Wed, 14 Jun 2023 23:58:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/atr0p0s">@<bdi>Atr0p0s</bdi></a> I've never tried this with a loader, but you can put a signal in your serialport-view.qml file to return the value of isPortOpened. Maybe someone else can chime in on doing this through a loader...</p>
]]></description><link>https://forum.qt.io/post/761482</link><guid isPermaLink="true">https://forum.qt.io/post/761482</guid><dc:creator><![CDATA[mzimmers]]></dc:creator><pubDate>Wed, 14 Jun 2023 23:58:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to get value from another qml on Thu, 15 Jun 2023 15:43:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mzimmers">@<bdi>mzimmers</bdi></a> I don't know how, but <code>Connection</code> with <code>Loader.item</code> works even if the item is null.</p>
<pre><code>Connections {
    target: serialportLoader.item
}
</code></pre>
<p dir="auto">Thank you! :)</p>
]]></description><link>https://forum.qt.io/post/761574</link><guid isPermaLink="true">https://forum.qt.io/post/761574</guid><dc:creator><![CDATA[Atr0p0s]]></dc:creator><pubDate>Thu, 15 Jun 2023 15:43:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to get value from another qml on Thu, 15 Jun 2023 06:38:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mzimmers">@<bdi>mzimmers</bdi></a> but I can't connect the signal from <code>serial-port.qml</code> with an object from <code>Main.qml</code> because <code>Loader</code> doesn't create an Object from it at startup...</p>
]]></description><link>https://forum.qt.io/post/761489</link><guid isPermaLink="true">https://forum.qt.io/post/761489</guid><dc:creator><![CDATA[Atr0p0s]]></dc:creator><pubDate>Thu, 15 Jun 2023 06:38:41 GMT</pubDate></item><item><title><![CDATA[Reply to How to get value from another qml on Wed, 14 Jun 2023 23:58:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/atr0p0s">@<bdi>Atr0p0s</bdi></a> I've never tried this with a loader, but you can put a signal in your serialport-view.qml file to return the value of isPortOpened. Maybe someone else can chime in on doing this through a loader...</p>
]]></description><link>https://forum.qt.io/post/761482</link><guid isPermaLink="true">https://forum.qt.io/post/761482</guid><dc:creator><![CDATA[mzimmers]]></dc:creator><pubDate>Wed, 14 Jun 2023 23:58:47 GMT</pubDate></item></channel></rss>