<?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[Dynamically Construct Path and PathLines]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I'm trying to extend my code to refactor QtQuick 1.1 qml using a repeater or timer onTriggered JS.  My ugly code (working), with 24 PathLine elements,<br />
Item {<br />
property Path myPath: Path {<br />
PathLine {x: 0; y: 0}<br />
PathLine {x: 1; y: 0}<br />
PathLine {x: 2; y: 0}<br />
...<br />
PathLine {x: 23; y: 0}<br />
}<br />
}</p>
<p dir="auto">I've tried variations on Repeater/Model.... without success.  Usually  QT returns 'can't assign object to list'.</p>
<p dir="auto">Is there a way through code to initialize the Path with 'n' number of PathLines.   Any help would be most appreciated.<br />
Thank you</p>
]]></description><link>https://forum.qt.io/topic/146022/dynamically-construct-path-and-pathlines</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Nov 2026 09:43:22 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/146022.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Jun 2023 21:57:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dynamically Construct Path and PathLines on Thu, 29 Jun 2023 22:02:16 GMT]]></title><description><![CDATA[<p dir="auto">I have the Path and PathLine working with the above initial declaration of Path and Pathline.  What I've been trying to do is either user a timer OnTriggered to create the Path and append/push... pathElements, or, use a Repeater to create the path.  Variations on things I've tried below.</p>
<p dir="auto">a) Timer OnTriggered,</p>
<pre><code>var pathLine = Qt.createQmlObject('import QtQuick 1.1;PathLine {x:0; y:0}',_myPath)
  if(_myPath.pathElements.length == 0) {
        for(var j=0;j&lt;24;j++) {
        _myPath.pathElements.push({"x":j,"y":0})
       }
     }
</code></pre>
<p dir="auto">b) Repeater,</p>
<pre><code>Repeater{
  	id: repeater
  	model: myModel
  		delegate: Item{
  			property ShapePath s: ShapePath{					
  			strokeWidth: 2
      PathLine{x: model.x; y: model.y}
  			}
  			Component.onCompleted: {
  				shape.data.push(s)
  			}
  		}
  	}		
  }
</code></pre>
<p dir="auto">My line chart is 48 segments and is fine for what I'm trying to do.  The code is not very elegant, but works.   Thanks</p>
]]></description><link>https://forum.qt.io/post/763094</link><guid isPermaLink="true">https://forum.qt.io/post/763094</guid><dc:creator><![CDATA[dmac001]]></dc:creator><pubDate>Thu, 29 Jun 2023 22:02:16 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamically Construct Path and PathLines on Tue, 27 Jun 2023 20:51:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dmac001">@<bdi>dmac001</bdi></a> Use PathPolyLine and just give it a list of points.</p>
<p dir="auto"><a href="https://doc.qt.io/qt-6/qml-qtquick-pathpolyline.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qml-qtquick-pathpolyline.html</a></p>
]]></description><link>https://forum.qt.io/post/762798</link><guid isPermaLink="true">https://forum.qt.io/post/762798</guid><dc:creator><![CDATA[fcarney]]></dc:creator><pubDate>Tue, 27 Jun 2023 20:51:59 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamically Construct Path and PathLines on Tue, 27 Jun 2023 10:24:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dmac001">@<bdi>dmac001</bdi></a> I haven't any experience with this, but from looking at the docs, it looks like you could programmatically assign to the <code>pathElements</code> property. I don't think <code>Path</code> supports a model-based instantiation of its children.</p>
]]></description><link>https://forum.qt.io/post/762734</link><guid isPermaLink="true">https://forum.qt.io/post/762734</guid><dc:creator><![CDATA[Bob64]]></dc:creator><pubDate>Tue, 27 Jun 2023 10:24:16 GMT</pubDate></item></channel></rss>