<?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[Create button component inside scrool view list]]></title><description><![CDATA[<p dir="auto">i have a scroll view and i want to add button from loop and edit your text</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/367449a0-3b5a-4840-b141-6481cb97e9a9.png" alt="bb982ec0-6efd-4468-a656-93554773abc4-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I created a qml form file, but i dont now how to add it using code</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/c44dcb53-f423-4682-a03b-949caeb283ec.png" alt="af96c65d-752b-47a0-a681-81d64386fb44-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/topic/130017/create-button-component-inside-scrool-view-list</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 11:27:25 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/130017.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 03 Sep 2021 23:50:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Create button component inside scrool view list on Sat, 04 Sep 2021 02:58:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eyllanesc">@<bdi>eyllanesc</bdi></a> tanks a looott</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/40da468c-2164-4863-9e6e-569e2a44ef25.png" alt="6b26e01d-b0e2-455c-ac87-63f45d15f375-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/679189</link><guid isPermaLink="true">https://forum.qt.io/post/679189</guid><dc:creator><![CDATA[Nathan Miguel]]></dc:creator><pubDate>Sat, 04 Sep 2021 02:58:37 GMT</pubDate></item><item><title><![CDATA[Reply to Create button component inside scrool view list on Sat, 04 Sep 2021 00:32:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nathan-miguel">@<bdi>Nathan-Miguel</bdi></a></p>
<p dir="auto">A trivial solution is to use Component.createObject to create the buttons and add it to a ColumnLayout:</p>
<pre><code>import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

ApplicationWindow {
    visible: true
    width: 100
    height: 100
    ScrollView {
        anchors.fill: parent
        ColumnLayout {
            id: columnLayout
        }
    }
    property Component buttonProvider: Button {
    }
    Component.onCompleted: {
        for(let i=0; i &lt; 10; ++i){
            var button = buttonProvider.createObject(columnLayout)
            button.text = i
        }
    }
}
</code></pre>
<p dir="auto">On the other hand, another better solution is to use a model together with a Repeater since if the model is modified, the text of the buttons is modified for example.</p>
<pre><code class="language-qml">import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

ApplicationWindow {
    visible: true
    width: 100
    height: 100
    ListModel {
        id: listModel
        Component.onCompleted: {
            for (let i = 0; i &lt; 10; ++i) {
                listModel.append({
                    "value": i
                });
            }
        }
    }
    ScrollView {
        anchors.fill: parent
        ColumnLayout {
            Repeater {
                model: listModel
                Button {
                    text: model.value
                    width: 100
                    height: 100
                }
            }
        }
    }
}
</code></pre>
]]></description><link>https://forum.qt.io/post/679183</link><guid isPermaLink="true">https://forum.qt.io/post/679183</guid><dc:creator><![CDATA[eyllanesc]]></dc:creator><pubDate>Sat, 04 Sep 2021 00:32:08 GMT</pubDate></item></channel></rss>