<?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[TextField within ListView]]></title><description><![CDATA[<p dir="auto">I have created a listview with a delegate that produces a textfield. The effect is a flickable column of multiple text fields. It seems that Qt repaints these text fields as they appear and disappear from the viewable area which makes the program run a bit sluggish. I've had to place a few hacks to get the value and save it to the corresponding model, which led me thinking that I am perhaps going about this the wrong way. I haven't seen any examples with a textfield inside of a listview, so maybe I should use a different delegate?</p>
]]></description><link>https://forum.qt.io/topic/49401/textfield-within-listview</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 02:42:33 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/49401.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 18 Dec 2014 20:39:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TextField within ListView on Thu, 18 Dec 2014 22:26:41 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Your delegates have access to a special property "index".<br />
I refer to the link below for more explanation.</p>
<p dir="auto"><a href="https://qt-project.org/doc/qt-5-snapshot/qtquick-modelviewsdata-modelview.html#models" target="_blank" rel="noopener noreferrer nofollow ugc">https://qt-project.org/doc/qt-5-snapshot/qtquick-modelviewsdata-modelview.html#models</a></p>
<p dir="auto">But if you do something like, you can see it:</p>
<p dir="auto">@     onValueChanged:   {<br />
console.log("index = " + index)<br />
}<br />
@</p>
<p dir="auto">Changing the value of the model can be done like so:</p>
<p dir="auto">@onAccepted: {console.log("accepted"); myModel.set(index, {...})}@</p>
<p dir="auto">Also ListView has a currentIndex and currentItem property if you need those.</p>
<p dir="auto">Good luck!</p>
]]></description><link>https://forum.qt.io/post/254858</link><guid isPermaLink="true">https://forum.qt.io/post/254858</guid><dc:creator><![CDATA[t3685]]></dc:creator><pubDate>Thu, 18 Dec 2014 22:26:41 GMT</pubDate></item><item><title><![CDATA[Reply to TextField within ListView on Thu, 18 Dec 2014 20:59:54 GMT]]></title><description><![CDATA[<p dir="auto">This is my model:</p>
<p dir="auto">@ListModel {<br />
id: myModel<br />
ListElement {<br />
name: "Speed"<br />
units: "mm*100/s"<br />
group: "conveyor"<br />
mValue: "10"<br />
mid: 0<br />
}<br />
....@</p>
<p dir="auto">and my delegate consist of a TextField with:<br />
@ onValueChanged:   {<br />
// Save the input<br />
if(inputText != ""){<br />
myModel.set(mid, {"mValue": inputText});<br />
console.log(mid + "==" + inputText)<br />
}<br />
}@</p>
<p dir="auto">I use "mid" to identify the index and the inputText then to save. I have it working alright, but I couldn't find a way to grab the current delegate index as wel.</p>
]]></description><link>https://forum.qt.io/post/254836</link><guid isPermaLink="true">https://forum.qt.io/post/254836</guid><dc:creator><![CDATA[justin1122]]></dc:creator><pubDate>Thu, 18 Dec 2014 20:59:54 GMT</pubDate></item><item><title><![CDATA[Reply to TextField within ListView on Thu, 18 Dec 2014 20:54:13 GMT]]></title><description><![CDATA[<p dir="auto">How does your model look like? It should be quite straightforward to save the value to the model no?</p>
]]></description><link>https://forum.qt.io/post/254833</link><guid isPermaLink="true">https://forum.qt.io/post/254833</guid><dc:creator><![CDATA[t3685]]></dc:creator><pubDate>Thu, 18 Dec 2014 20:54:13 GMT</pubDate></item></channel></rss>