thanks for your answer.
I didn’t really create the items dynamically, they are all created in declarative QML, the grid is done via a Repeater-element, and the other items are in LevelXX.qml files, which are loaded by a Loader-element
Actually, the z-ordering works fine when i just specify the “z” property of all my entities.
But the problem is: because of the 2.5D-look, items in the lowest row have to be drawn above items in the second row from the bottom, and so on. If you look closely at the player, the wall beneath him overlaps him, which is intentional.
So the z-order formula is this:
z: row * 10 + level
Which works fine to build up the level. (“row” is the y value in the grid, so 0,1,…4 and “level” is the vertical position on an imaginary axis pointing out of the screen, which can be 0,1 or 2 right now)
But when the row-value changes, the ordering needs to change, because then sometimes a box in a lower row has to overlap another box, which previously wasn’t the case.