<?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[StackView attached properties not visible in pushed objects]]></title><description><![CDATA[<p dir="auto">I have a StackView which includes</p>
<p dir="auto">initialItem: Qt.resolvedUrl("file.qml")</p>
<p dir="auto">In the root Item in file.qml, I can do</p>
<p dir="auto">Stack.view.push(Qt.resolvedUrl("another.qml")).</p>
<p dir="auto">But in the root Item of another.qml, a reference to Stack.view gives the error:</p>
<p dir="auto">ReferenceError: Stack is not defined</p>
<p dir="auto">Shouldn't the StackView's attached properties be visible in any QML file loaded by the StackView?</p>
]]></description><link>https://forum.qt.io/topic/46814/stackview-attached-properties-not-visible-in-pushed-objects</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 23:24:54 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/46814.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Oct 2014 17:56:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to StackView attached properties not visible in pushed objects on Sat, 11 May 2019 20:05:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gselabs">@<bdi>GSElabs</bdi></a><br />
<a href="https://doc.qt.io/qt-5/qtqml-syntax-objectattributes.html#a-note-about-accessing-attached-properties-and-signal-handlers" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qtqml-syntax-objectattributes.html#a-note-about-accessing-attached-properties-and-signal-handlers</a></p>
<p dir="auto">"A common error is to assume that attached properties and signal handlers are directly accessible from the children of the object to which these attributes have been attached. This is not the case. The instance of the attaching type is only attached to specific objects, not to the object and all of its children."</p>
]]></description><link>https://forum.qt.io/post/528352</link><guid isPermaLink="true">https://forum.qt.io/post/528352</guid><dc:creator><![CDATA[Nifiro]]></dc:creator><pubDate>Sat, 11 May 2019 20:05:12 GMT</pubDate></item><item><title><![CDATA[Reply to StackView attached properties not visible in pushed objects on Sat, 11 May 2019 19:19:44 GMT]]></title><description><![CDATA[<p dir="auto">I  also have been trying to use attached StackView properties in a component is pushed to a StackView without any luck.  I am wondered why this is not worked? So currently I use the ugly workaround accessing StackView by id from a component which was pushed to the StackView.</p>
<p dir="auto">The following code located inside component pushed to StackView:</p>
<pre><code>    Component.onCompleted: {
        console.log(StackView.index + " is stack index of the item")
    }
</code></pre>
<p dir="auto">Gives the following error:</p>
<pre><code>qrc:/content/IdlePage.qml:18: ReferenceError: StackView is not defined
</code></pre>
<p dir="auto">But the manual states:</p>
<pre><code>Attached Property Documentation

[read-only] StackView.index : int

This attached property holds the stack index of the item it's attached to, or -1 if the item is not in a stack.
</code></pre>
<p dir="auto">What I am missing?</p>
]]></description><link>https://forum.qt.io/post/528343</link><guid isPermaLink="true">https://forum.qt.io/post/528343</guid><dc:creator><![CDATA[GSElabs]]></dc:creator><pubDate>Sat, 11 May 2019 19:19:44 GMT</pubDate></item><item><title><![CDATA[Reply to StackView attached properties not visible in pushed objects on Thu, 09 Oct 2014 16:52:04 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="dasRicardo" date="1412850595"]parent.view.push[/quote]</p>
<p dir="auto">You can't do parent.view.push, but you can do parent.push.  But that's not very convenient if you're not in the root Item.</p>
<p dir="auto">I've found that the id: of the StackView is visible in its children, so if its id: is stackView, you can do stackView.push() anywhere in the child.</p>
]]></description><link>https://forum.qt.io/post/246818</link><guid isPermaLink="true">https://forum.qt.io/post/246818</guid><dc:creator><![CDATA[xargs]]></dc:creator><pubDate>Thu, 09 Oct 2014 16:52:04 GMT</pubDate></item><item><title><![CDATA[Reply to StackView attached properties not visible in pushed objects on Thu, 09 Oct 2014 10:29:55 GMT]]></title><description><![CDATA[<p dir="auto">Hmm, have you tried to use parent instead of Stack like:<br />
@<br />
parent.view.push(Qt.resolvedUrl(“another.qml”))<br />
@</p>
]]></description><link>https://forum.qt.io/post/246770</link><guid isPermaLink="true">https://forum.qt.io/post/246770</guid><dc:creator><![CDATA[dasRicardo]]></dc:creator><pubDate>Thu, 09 Oct 2014 10:29:55 GMT</pubDate></item></channel></rss>