QTree - is it possible to extend the header slots?
Would it be possible to extend the QTree header slots to include the whole header element and not only the header content part (which excludes the expand icon and the header element itself)?
Here is an illustration of what I mean (use-cases follow):
I have 2 use-cases why I need this:
- Adding drag-n-drop capability to the QTree elements via the TouchPan directive
Unfortunately QTree does not support drag-n-drop so I decided to find a way to implement my own. I was thinking that having access to the QTree header slot would allow me to insert such functionality. Alas, currently I can only control the contents of the
.q-tree__node-header-contentelement (which is a descendant of where I want to add draggability) via the QTree header slot but in order to add
v-touch-panI need access to an ancestor element. If it would be possible to override the whole
.q-tree__node-headerelement via a header slot, that would work since then I would build the header myself (e.g. using QItem component or something else) and I would be able to add the
- I also want to make every item in the tree span the whole width of the main container. Here is an illustration of what I mean (I have removed the connector lines via CSS):
IMHO if I can override the whole header element then I would calculate the padding for each item (increasing with indent level) and that way I could keep the header element span the full width.
Just for the record - currently I believe it might not be possible to overcome this simply with CSS because I could remove the default padding for children but then it would be a nightmare to add paddings to every element without full access to the header element.
s.molinari last edited by
You might want to look at QList, QItem, and QExpansionItem.
Yes, that is the “build your own Tree View component from scratch” approach. I was considering this but before I jump into the deep I wanted to explore if QTree could be exploited for the purpose.
So my original question still stands - would it be possible to extend the QTree component with such capabilities?
Thanks for the suggestion!
metalsadman last edited by
@ddenev post a detailed feature request in gh, i saw your post there but it’s more like a question.
@metalsadman, thank you, I was not completely sure if that is feasible to implement and that is why I stated it as a question.
BTW, Razvan just stated in GH that he is OK to add a “full header slot” support.