Solved Z-Order globally
-
Hi,
how i can use z-globally ?
(z-order work only on siblings ....how i have read)heir is a simple sample (https://saengjja.tistory.com/176) (ok on china-language but code is clear )
how I can override here "yellow"-rectangle ?What is this solution for this problem ?
thanks a lot !!!
Marian -
Rectangle { color: "yellow" } Rectangle { color: "red" Rectangle { color: "blue" } }
If you want yellow behind the other rectangles then declare it before the other rectangles.
-
Hi fcarney,
yes but this is not really solution !
This only simple example ....
In my app I have much row-list-views with much Items, (all dynamically load), If I move a Item that need always on top ..... need undepend from load order !!! -
If your Items are model driven then change the order of the items in the model.
You might be better served to create a minimal example that represents what you are actually doing than a contrived simplistic version.
I will often create a side project that accurately reflects what I am doing and recreates the problem. Code is cut and pasted from larger projects in order to keep the example as accurate as possible. This takes time, but it will save you time when asking for help.
-
@krowa
ok, here's a hack for your problem:- Create a c++ class either as root context property or as a singleton.
- Give it a Q_PROPERTY of QObject *
- at the top most level inside main.qml assign the root element to that c++ QObject -Pointer
- where you need it / want a top level/ top z-order, use this object pointer for the parent property of the QML Item
I use this for a custom Popup component, in an application where the root component is neither a Window or Application Window.
It works, but it will make your skin crawl :D
-
You just gave me an idea. I don't read chinese so I cannot tell what they are trying to accomplish. But qml has a way to use states to change parenting of an object. This could be used to reparent an object to do what you said. So the selected item could reparent itself as a popup.
-
I thought and hoped that this was a totally trivial problem and I just overlooked something ...
look like this no standart solution....
- what is this technical problem ?
- what is solution of this problem ?
@fcarney
I thinking this example describe and show my understanding problem.
I was very surprised that it doesn't work as I think.....@J.Hilk
ok, is but this is a hack , I will read you code tomorow again and have sure question :-)for my understanding, I sure could if I move a item, first remove/delete this item and after add again ......but this not really solution, very dirty hack .......
Marian
-
@krowa A state can temporarily change the parenting of an object. When the state clears it is reset.
This could be used to temporarily move the object to a different parent with a higher z order priority.
-
Hi
I have change parent if I moving the item to root element and it WORKS!
thanks a lot J.Hilk, fcarney
Marian