<?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[TreeView. How to get itemDelegate&#x27;s property outside itemDelegate?]]></title><description><![CDATA[<pre><code>Controls1.TreeView {
                id: tv1
                anchors.fill: parent
                model: treeModel
                headerVisible: false
                itemDelegate: PlanItemDelegate {
                    id: planItemDelegate
                    fullMdl: tv1.model
                    indx: styleData.index                   
                    closedHeight: mainW.height / 12
                    open: styleData.selected
                    onButtonMinimizeClicked: {
                        root.changeCurrentIndex(-1)
                    }
                }
                rowDelegate: Rectangle {
                    height: ///////// ???? how to make it equal to itemDelegate.height?
                    color: "white"                  
                }
                style: TreeViewStyle {
                    branchDelegate: Rectangle {
                        color: "transparent"
                        height: 80
                        width: height
                    }                    
                }
}
</code></pre>
<p dir="auto">How to get itemDelegate's height outside itemDelegate?</p>
]]></description><link>https://forum.qt.io/topic/69987/treeview-how-to-get-itemdelegate-s-property-outside-itemdelegate</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 13:40:48 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/69987.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 Aug 2016 20:47:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TreeView. How to get itemDelegate&#x27;s property outside itemDelegate? on Sat, 06 Aug 2016 22:20:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kofr">@<bdi>Kofr</bdi></a> said:</p>
<blockquote>
<p dir="auto">the internal properties of PlanItemDelegate depends on styleData.* properties, so if I try to make</p>
</blockquote>
<p dir="auto">But they're already bound.</p>
<pre><code>PlanItemDelegate {
    id: planItemDelegate
    fullMdl: tv1.model
    indx: styleData.index                     //&lt; This is a binding, isn't it?
    closedHeight: mainW.height / 12
    open: styleData.selected
    onButtonMinimizeClicked: {
        root.changeCurrentIndex(-1)
    }
}
</code></pre>
<p dir="auto">What difference does it make if you create the <code>PlanItemDelegate</code> and then pass the reference by id, or just pass the reference. I don't see any difference or problem whatsoever. Perhaps I'm wrong, but it really seems the same to me. The only thing I don't know is where the <code>styleData</code> object is defined ...</p>
<p dir="auto">PS.<br />
I have now encountered <code>styleData</code>, but am still not sure where it comes from, or rather how it's supposed to be accessed.</p>
]]></description><link>https://forum.qt.io/post/341101</link><guid isPermaLink="true">https://forum.qt.io/post/341101</guid><dc:creator><![CDATA[kshegunov]]></dc:creator><pubDate>Sat, 06 Aug 2016 22:20:43 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView. How to get itemDelegate&#x27;s property outside itemDelegate? on Sat, 06 Aug 2016 21:40:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kshegunov">@<bdi>kshegunov</bdi></a> said:</p>
<blockquote>
<p dir="auto">indx: styleData.index<br />
closedHeight: mainW.height / 12<br />
open: styleData.selected</p>
</blockquote>
<pre><code>...
indx: styleData.index                   
    ...
    open: styleData.selected
...
</code></pre>
<p dir="auto">the internal properties of PlanItemDelegate depends on <code>styleData.*</code> properties, so if I try to make</p>
<pre><code>itemDelegate: planItemDelegate
</code></pre>
<p dir="auto">I can not bind this custom properties. Or Now I think about some js function like</p>
<pre><code>itemDelegate: {var copyObj = planItemDelegate; copyObj.index = Qt.binding(function() {return styleData.index }); copyObj}</code></pre>
]]></description><link>https://forum.qt.io/post/341099</link><guid isPermaLink="true">https://forum.qt.io/post/341099</guid><dc:creator><![CDATA[Kofr]]></dc:creator><pubDate>Sat, 06 Aug 2016 21:40:53 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView. How to get itemDelegate&#x27;s property outside itemDelegate? on Sat, 06 Aug 2016 21:33:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kofr">@<bdi>Kofr</bdi></a><br />
What is <code>styleData</code>?</p>
<blockquote>
<p dir="auto">And if I reference this object by id, how do I bind delegate specific properties?</p>
</blockquote>
<p dir="auto">I'm not sure I understand the question. What delegate specific properties you want to bind, and to what?<br />
Do you mean something like this:</p>
<pre><code>Text  {
    text: planItemDelegate.closedHeight
}
</code></pre>
<p dir="auto">Do bear in mind, that as I noted my whole experience with QML totals the 2 hours I put in this evening, so I may be completely misleading you ...</p>
]]></description><link>https://forum.qt.io/post/341096</link><guid isPermaLink="true">https://forum.qt.io/post/341096</guid><dc:creator><![CDATA[kshegunov]]></dc:creator><pubDate>Sat, 06 Aug 2016 21:33:49 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView. How to get itemDelegate&#x27;s property outside itemDelegate? on Sat, 06 Aug 2016 21:27:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kshegunov">@<bdi>kshegunov</bdi></a> it does not work out in this case as this delegate uses <code>styleData.index</code> and <code>styleData.selected</code> which is different for every delegate.<br />
And if I reference this object by id, how do I bind delegate specific properties?</p>
]]></description><link>https://forum.qt.io/post/341095</link><guid isPermaLink="true">https://forum.qt.io/post/341095</guid><dc:creator><![CDATA[Kofr]]></dc:creator><pubDate>Sat, 06 Aug 2016 21:27:57 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView. How to get itemDelegate&#x27;s property outside itemDelegate? on Sat, 06 Aug 2016 21:09:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kofr">@<bdi>Kofr</bdi></a><br />
Hm, I'm just guessing, but I'd also try reshuffling like this:</p>
<pre><code>itemDelegate: planItemDelegate

PlanItemDelegate {
    id: planItemDelegate
    fullMdl: tv1.model
    indx: styleData.index                   
    closedHeight: mainW.height / 12
    open: styleData.selected
    onButtonMinimizeClicked: {
        root.changeCurrentIndex(-1)
    }
}

rowDelegate: Rectangle {
    height: planItemDelegate.height
    color: "white"                  
}
</code></pre>
<p dir="auto">This is how I anchor things to one another, at least in a very similar matter.</p>
]]></description><link>https://forum.qt.io/post/341092</link><guid isPermaLink="true">https://forum.qt.io/post/341092</guid><dc:creator><![CDATA[kshegunov]]></dc:creator><pubDate>Sat, 06 Aug 2016 21:09:19 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView. How to get itemDelegate&#x27;s property outside itemDelegate? on Sat, 06 Aug 2016 21:05:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kshegunov">@<bdi>kshegunov</bdi></a>, Yes, it has property <code>height</code></p>
<pre><code>rowDelegate: Rectangle {
                    height: planItemDelegate.height
...
</code></pre>
<p dir="auto"><code>ReferenceError: planItemDelegate is not defined</code><br />
And this is real trouble to get this property. I have not found approach to get it.</p>
]]></description><link>https://forum.qt.io/post/341091</link><guid isPermaLink="true">https://forum.qt.io/post/341091</guid><dc:creator><![CDATA[Kofr]]></dc:creator><pubDate>Sat, 06 Aug 2016 21:05:50 GMT</pubDate></item><item><title><![CDATA[Reply to TreeView. How to get itemDelegate&#x27;s property outside itemDelegate? on Sat, 06 Aug 2016 20:59:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kofr">@<bdi>Kofr</bdi></a> said:<br />
I'm a complete QML noobster, but doesn't this:</p>
<pre><code>rowDelegate: Rectangle {
    height: planItemDelegate.height
    color: "white"                  
}
</code></pre>
<p dir="auto">just work?</p>
<p dir="auto">PS.<br />
... assuming the <code>PlanItemDelegate</code> component has that property.</p>
]]></description><link>https://forum.qt.io/post/341089</link><guid isPermaLink="true">https://forum.qt.io/post/341089</guid><dc:creator><![CDATA[kshegunov]]></dc:creator><pubDate>Sat, 06 Aug 2016 20:59:05 GMT</pubDate></item></channel></rss>