How can I reorder the items in a GridLayout (or other QML item containers generally)? I have one with some number of rows and columns and populated with child items. Until a few minutes ago I was hoping I could simply operate on the children list member of the item to reorder them: I have a MouseArea button in the UI from which I was hoping could simply invoke (from onClicked:) a
function reorder() {children.unshift(children.pop());}
method of the layout item (with the intention of the last item in the layout becoming the first), but when triggered that generates the error message:
TypeError: Property 'pop' of object [object Object] is not a function
and in any case I note the documentation says children is read only.
Is there an easy way of doing this? (The documentation on dynamic object management doesn't really cover more than creation and destruction of child objects.)
You can use the row and column attached properties.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With