<?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[access to swipeview children from outside of it]]></title><description><![CDATA[<p dir="auto">Hi, I want to have a rectangle located on a swipeview and it should load different qml pages when swipeview index changes. please have look at following code:</p>
<pre><code>Item {
    SwipeView
    {
        id: swipView
        currentIndex: 0
        anchors.fill: parent
        Repeater
        {
            model: 3
            Page
            {
                id: delegate
                Button {
                    text: "&lt;"
                    width: 18
                    height: 40
                    enabled: index &gt; 0
                    onClicked:
                    {
                        delegate.SwipeView.view.decrementCurrentIndex()                        
                    }
                    anchors.left: parent.left
                    anchors.verticalCenter: parent.verticalCenter
                }

                Button {
                    text: "&gt;"
                    width: 18
                    height: 40
                    enabled: index &lt; delegate.SwipeView.view.count - 1
                    onClicked:
                    {
                        delegate.SwipeView.view.incrementCurrentIndex()                        
                    }
                    anchors.right: parent.right
                    anchors.verticalCenter: parent.verticalCenter
                }
                Rectangle
                {
                    id: pgRect
                    state: "blue"
                    anchors
                    {
                        left: parent.left
                        top: parent.top
                        leftMargin: 18
                        topMargin: 18
                        rightMargin: 18
                        bottomMargin: 18
                        fill: parent
                    }
                    Loader
                    {
                        id: loader
                        anchors.fill: parent
                    }
                    Connections
                    {
                        target: loader.source != "" ? loader.item : null
                    }
                    states: [
                        State {
                            name: "page1"
                            PropertyChanges {
                                target: loader
                                source: "PageI.qml"
                            }
                        },
                        State {
                            name: "page2"
                            PropertyChanges {
                                target: loader
                                source: "PageII.qml"
                            }
                        },
						State {
                            name: "page3"
                            PropertyChanges {
                                target: loader
                                source: "PageIII.qml"
                            }
                        }
                    ]

                }
            }
        }
		onCurrentIndexChanged: 
        {      
        
            if(swipView.currentIndex === 0)
            {
                // change pgRect.state
            }
        
        }
    }
}

</code></pre>
<p dir="auto">i want to have access to rectangle properties and change its state (changing the qml page loaded on rectangle) in onCurrentIndexChanged signal.<br />
but it says: pgRect is not defined.</p>
]]></description><link>https://forum.qt.io/topic/124406/access-to-swipeview-children-from-outside-of-it</link><generator>RSS for Node</generator><lastBuildDate>Wed, 17 Jun 2026 22:58:04 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/124406.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Mar 2021 13:39:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to access to swipeview children from outside of it on Thu, 04 Mar 2021 17:32:25 GMT]]></title><description><![CDATA[<p dir="auto">Modify the Repeater as</p>
<pre><code>Repeater{
    id : rep1
    Page {
      property alias myrect : pgrect
</code></pre>
<p dir="auto">Access each element inside the repeater using rep1.itemAt(index).</p>
]]></description><link>https://forum.qt.io/post/647705</link><guid isPermaLink="true">https://forum.qt.io/post/647705</guid><dc:creator><![CDATA[dheerendra]]></dc:creator><pubDate>Thu, 04 Mar 2021 17:32:25 GMT</pubDate></item></channel></rss>