<?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[Problem with GridView]]></title><description><![CDATA[<p dir="auto">So hello fellow Qt Quick developers. Since a while I was making a simple program for creating customizable color palettes. User will create and customize the whole palette by adding and customizing rectangles. The best way I've found to display them and get the flickable to work was by using GridView.</p>
<p dir="auto">And here is the problem, I would need to somehow access particular rectangle's color variable in order to customize it.  But, as far as I know, the gridView component isn't allowing me to do such a  thing. My best thought (Please, don't punch me  for that) was to create unique id while creating a rectangle, and later on, apply it by using JS. And as you can predict, this approach isn't working at all (well, maybe only this applying part). So, is there a better way to do it? And if yes, how?</p>
<p dir="auto">Here is my code for GridView:</p>
<pre><code>GridView {
            id: gridView1
            flickableDirection: Flickable.VerticalFlick
            snapMode: GridView.NoSnap
            highlightRangeMode: GridView.NoHighlightRange
            highlightMoveDuration: 148
            flow: GridView.FlowLeftToRight
            layoutDirection: Qt.RightToLeft
            anchors.rightMargin: 5
            anchors.leftMargin: 5
            anchors.bottomMargin: 10
            anchors.topMargin: 10
            delegate: Item {
                height: 100
                Column {
                   ColorBlock
                   {
                     width: 100
                     height: 100
                   }
                }
            }
            model: ListModel {
              id: tEST
            }
            cellHeight: 100
            cellWidth: 100
        }
</code></pre>
<p dir="auto">and for my rectangle :</p>
<pre><code>Rectangle {
    Variables
    {
        id:vars
    }

    property string namE: vars.normalName
    property  var colorR
    id: namE
    width: 70
    height: 70
    color: colorR

    MouseArea {
        id: mouseArea1
        anchors.fill: parent

        onClicked:
        {
            console.log("test")
            console.log(namE.namE)
        }
    }
}
</code></pre>
<p dir="auto">and variables:</p>
<pre><code>Item {
     id : varialbeS
     property string baseNamne: "justTestName";
     property int numbeR: 0
     property string normalName: baseNamne + numbeR.toString();

     property string objectNamE
}
</code></pre>
<p dir="auto">Yes, I know, it was very stupid approach, but I'm still learining.</p>
<p dir="auto">Thanks in advance!</p>
]]></description><link>https://forum.qt.io/topic/70794/problem-with-gridview</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 19:25:06 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/70794.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 31 Aug 2016 19:32:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem with GridView on Thu, 01 Sep 2016 10:27:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lorow23">@<bdi>lorow23</bdi></a></p>
<blockquote>
<p dir="auto">but how I should acces particular rectangles then?</p>
</blockquote>
<p dir="auto">With the model approach it wont be required. The delegate items will get the data from model. Also when required you just need to update the model with new data from the delegate or from outside.<br />
For eg. <a href="http://doc.qt.io/qt-5/qml-qtqml-models-listmodel.html#methods" target="_blank" rel="noopener noreferrer nofollow ugc">ListModel</a> has several methods to access the data.</p>
]]></description><link>https://forum.qt.io/post/345326</link><guid isPermaLink="true">https://forum.qt.io/post/345326</guid><dc:creator><![CDATA[p3c0]]></dc:creator><pubDate>Thu, 01 Sep 2016 10:27:32 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with GridView on Thu, 01 Sep 2016 09:45:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/p3c0">@<bdi>p3c0</bdi></a> I will try that, but how I should acces particular rectangles then?</p>
]]></description><link>https://forum.qt.io/post/345319</link><guid isPermaLink="true">https://forum.qt.io/post/345319</guid><dc:creator><![CDATA[lorow23]]></dc:creator><pubDate>Thu, 01 Sep 2016 09:45:07 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with GridView on Thu, 01 Sep 2016 05:24:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lorow23">@<bdi>lorow23</bdi></a> The best approach for this is to store the information in the model and not the delegate.</p>
]]></description><link>https://forum.qt.io/post/345275</link><guid isPermaLink="true">https://forum.qt.io/post/345275</guid><dc:creator><![CDATA[p3c0]]></dc:creator><pubDate>Thu, 01 Sep 2016 05:24:29 GMT</pubDate></item></channel></rss>